Skip to content

fix: make redacted credential fields nullable on response types - #5

Open
riteshptl21 wants to merge 1 commit into
VapiAI:mainfrom
riteshptl21:fix/nullable-credential-fields
Open

fix: make redacted credential fields nullable on response types#5
riteshptl21 wants to merge 1 commit into
VapiAI:mainfrom
riteshptl21:fix/nullable-credential-fields

Conversation

@riteshptl21

Copy link
Copy Markdown

Fixes #4.

The API redacts secrets on read and returns null for credential fields, but 93 type files declare them as non-nullable string — so deserializing any response containing a redacted credential throws a TypeError and fails the entire call (a single BYO SIP number breaks the whole phoneNumbers->list() response, for example).

What this changes

All 95 affected field instances across 93 files (apiKey, credentialId, apiSecret, awsSecretAccessKey, password, token, accessToken, sessionToken, secretKey, secretAccessKey, clientSecret, tokenUri), mechanically:

-     * @var string $password ...
+     * @var ?string $password ...
-    public string $password;
+    public ?string $password;
-     *   password: string,
+     *   password?: ?string,
-        $this->password = $values['password'];
+        $this->password = $values['password'] ?? null;

The write path is unchanged: values supplied at the call site serialize exactly as before.

Verification

Note for maintainers

Since this repo is Fern-generated, these files will be overwritten on the next regeneration — the durable fix is marking redacted-on-read credential fields as nullable in the API definition/generator config. This PR fixes the published SDK in the meantime and doubles as the exact change list for the generator-side fix.

The API redacts secrets on read and returns null for credential
fields, but 93 type files declared them as non-nullable string,
so deserializing any response containing a redacted credential
threw a TypeError and failed the entire call.

Types the 95 affected fields (apiKey, credentialId, apiSecret,
awsSecretAccessKey, password, token, accessToken, sessionToken,
secretKey, secretAccessKey, clientSecret, tokenUri) as ?string
with null-tolerant constructor assignment. The write path is
unchanged: values supplied at the call site serialize as before.

Fixes VapiAI#4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Credential fields are typed non-nullable, so any redacted secret makes the whole response undecodable

1 participant