Skip to content

fix(rest/python): align sample server with ucp-sdk v0.5.0 model and schema updates - #232

Open
segiodongo wants to merge 2 commits into
Universal-Commerce-Protocol:mainfrom
segiodongo:fix/python-server-sdk-compat
Open

fix(rest/python): align sample server with ucp-sdk v0.5.0 model and schema updates#232
segiodongo wants to merge 2 commits into
Universal-Commerce-Protocol:mainfrom
segiodongo:fix/python-server-sdk-compat

Conversation

@segiodongo

Copy link
Copy Markdown

Summary of Changes

This PR updates the Python REST sample server to maintain compatibility with ucp-sdk v0.5.0 and the latest UCP protocol specifications:

  1. Common Schema Import Paths:

    • Updates imports for schemas (Payment, Total, PostalAddress, PaymentCreateRequest) with fallback to ucp_sdk.models.schemas.common.types.
  2. Fulfillment Destinations Model Alignment:

    • Converts destination objects to FulfillmentDestination instances with explicit type: "shipping_address" discriminators.
    • Safely retrieves optional postal attributes on FulfillmentDestination using getattr to support extra/dynamic schema fields without raising attribute errors.
  3. Checkout Totals Constraints:

    • Initializes newly created checkouts with required subtotal and total entries to satisfy Pydantic schema validation before totals calculation.
    • Ensures discount total entries use negative amounts (-discount_amount) per schema numeric bounds (amount < 0).
  4. Integration Tests:

    • Aligns sample server integration tests with updated request payloads, passing all tests cleanly.

damaz91 and others added 2 commits July 10, 2026 16:50
…chema updates

Update models and imports for common schemas (Payment, Total, PostalAddress).
Ensure fulfillment destinations are converted to FulfillmentDestination with proper discriminator types.
Ensure optional address attributes on FulfillmentDestination extra fields are accessed safely via getattr.
Initialize checkout totals with required subtotal and total entries to satisfy model validation.
Enforce negative discount amounts in totals per protocol schema specification.
Update server integration tests to match latest SDK types and pass cleanly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:needs-triage Signal that the PR is ready for human triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants