Skip to content

Make CandidateAddressKeyFormat fields nullable#42

Merged
elidrissidev merged 1 commit into
mainfrom
make-candidate-address-key-format-fields-nullable
May 11, 2026
Merged

Make CandidateAddressKeyFormat fields nullable#42
elidrissidev merged 1 commit into
mainfrom
make-candidate-address-key-format-fields-nullable

Conversation

@abramchenkoaa
Copy link
Copy Markdown
Collaborator

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.

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 elidrissidev merged commit ecdb27f into main May 11, 2026
1 check passed
@elidrissidev elidrissidev deleted the make-candidate-address-key-format-fields-nullable branch May 11, 2026 08:45
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.

2 participants