fix: make redacted credential fields nullable on response types - #5
Open
riteshptl21 wants to merge 1 commit into
Open
fix: make redacted credential fields nullable on response types#5riteshptl21 wants to merge 1 commit into
riteshptl21 wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4.
The API redacts secrets on read and returns
nullfor credential fields, but 93 type files declare them as non-nullablestring— so deserializing any response containing a redacted credential throws aTypeErrorand fails the entire call (a single BYO SIP number breaks the wholephoneNumbers->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:The write path is unchanged: values supplied at the call site serialize exactly as before.
Verification
password === nullinstead of throwingcomposer test: 52 tests, 220 assertions, all passingcomposer analyze(PHPStan level max): no errorsphp -lclean on all 93 changed filesNote 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.