Repository navigation
fix: use canonical shipping destination address fields - #97
FanouZeng-TT wants to merge 1 commit into
Conversation
|
Ran this branch against the reference with the python sdk at head: the 52 suite errors persist, because both construction sites still build shipping_destination.ShippingDestination while the post #83 destination unions accept only the request variants, so validation rejects the instance with a model_type error before the renamed fields are reached. On top of this branch, switching create_checkout_payload in integration_test_utils.py to ShippingDestinationCreateRequest and the test_update_checkout site in checkout_lifecycle_test.py to ShippingDestinationUpdateRequest takes the suite from 52 errors to 2. The remaining 2 are the OrderTest failures already red in the nightly since Aug 21, a server side Payment validation error in the reference, unrelated to these fields. |
|
Thanks for testing this against the SDK at head. I updated both construction sites to use the request-specific models: |
213395f to
df144e7
Compare
|
Rebased this branch onto the latest Local verification:
|
df144e7 to
4ca6f93
Compare
|
Updated this PR to also normalize the fixture destination in This closes the gap reported in #116: previously a destination configured with standard field names was silently replaced by the default locality. Verified offline against |
damaz91
left a comment
There was a problem hiding this comment.
Thank you for fixing this, @FanouZeng-TT!
Passing the canonical address_locality and address_region fields to ShippingDestinationCreateRequest and ShippingDestinationUpdateRequest aligns the request payloads with the PostalAddress schema in ucp-sdk (rather than relying on extra="allow" with legacy locality/region keys), and normalizing both canonical and legacy keys in DynamicFixtureContext.get_test_destination() ensures fixtures declared with standard UCP field names are preserved intact.
LGTM!
|
Thank you for the contribution, @FanouZeng-TT ! Few notes/suggestions:
Follow-up notes and not a requirement for this PR:
|
4ca6f93 to
be80cc9
Compare
|
Thanks for the detailed review, @gswetha. Addressed all seven points in
3–5. Fallback bugs fixed by a shared helper.
On your follow-up notes: I left Verification:
|
Description
ShippingDestinationinherits the canonical address fieldsaddress_localityandaddress_region. The conformance helpers instead passedlocalityandregionwhen creating destinations:The model accepts extra fields, so those names are serialized as non-contract
keys while
address_localityandaddress_regionremain unset. The samemismatch appears in the checkout-update lifecycle destination.
Fix: pass the canonical address field names in both construction paths.
A direct serialization regression confirms that the old keys omit the canonical
fields, while the corrected fields serialize exclusively as
address_localityandaddress_region.Type of change
Is this a Breaking Change or Removal?
N/A — fixes conformance test request construction without removing schema fields.
Checklist