Make CandidateAddressKeyFormat fields nullable#42
Merged
elidrissidev merged 1 commit intoMay 11, 2026
Conversation
Per the UPS Address Validation (XAV) API spec, only `CountryCode` is required to be returned in a Candidate AddressKeyFormat. All other fields are conditionally returned and may be omitted depending on the address type and match granularity: - `AddressLine`, `Region`, `PoliticalDivision2`, `PoliticalDivision1`: omitted for regional/international matches that don't resolve to that granularity - `PostcodePrimaryLow`: "Returned for countries or territories with Postal Codes" - `PostcodeExtendedLow`: "Only returned in candidate list" and only for countries that use range-style extensions (effectively US only) Production saw `TypeError: getPoliticalDivision2(): Return value must be of type string, null returned` and the equivalent for `getPostcodeExtendedLow()` when UPS returned candidates missing these fields. Marking them `nullable: true` in the OpenAPI spec lets Jane emit `?string` return types so the SDK no longer trips PHP 8.2 strict return checks on valid upstream responses.
elidrissidev
approved these changes
May 11, 2026
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.
Per the UPS Address Validation (XAV) API spec, only
CountryCodeis required to be returned in a Candidate AddressKeyFormat. All other fields are conditionally returned and may be omitted depending on the address type and match granularity:AddressLine,Region,PoliticalDivision2,PoliticalDivision1: omitted for regional/international matches that don't resolve to that granularityPostcodePrimaryLow: "Returned for countries or territories with Postal Codes"PostcodeExtendedLow: "Only returned in candidate list" and only for countries that use range-style extensions (effectively US only)Production saw
TypeError: getPoliticalDivision2(): Return value must be of type string, null returnedand the equivalent forgetPostcodeExtendedLow()when UPS returned candidates missing these fields. Marking themnullable: truein the OpenAPI spec lets Jane emit?stringreturn types so the SDK no longer trips PHP 8.2 strict return checks on valid upstream responses.