Skip to content

Conversation

@damaz91
Copy link

@damaz91 damaz91 commented Feb 5, 2026

This pull request refactors how checkout-related schemas are generated and used, simplifying the codebase and updating the schema generation process. The main changes include switching to a unified CheckoutSchema, updating the schema generation script to use new JSON schema definitions, and updating documentation to reflect these changes.

Schema usage and code simplification:

  • Replaced multiple specialized checkout schemas (e.g., CheckoutWithFulfillmentResponseSchema, CheckoutWithDiscountCreateRequestSchema) with a single, unified CheckoutSchema throughout src/extensions.ts, significantly simplifying type composition and schema extension. [1] [2] [3]

Schema generation process:

  • Updated the generate_models.sh script to use npx quicktype instead of quicktype directly, and switched to new JSON schema definitions and $defs for generating TypeScript types, aligning the generated models with the latest schema structure.

Documentation:

  • Updated the README.md to instruct users to generate models from the ucp/source directory instead of ucp/spec, reflecting the new schema location.

@damaz91 damaz91 requested a review from a team February 5, 2026 10:36
git clone https://github.com/Universal-Commerce-Protocol/ucp.git
```

Then, run `npm run generate` pointing to the `spec` folder of the cloned
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: pointing to the source folder

.extend(
CheckoutWithBuyerConsentCreateRequestSchema.pick({ buyer: true }).shape
);
export const ExtendedCheckoutCreateRequestSchema = CheckoutSchema;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really necessary to export if it doesn't extend anything anymore?

.extend(
CheckoutWithBuyerConsentUpdateRequestSchema.pick({ buyer: true }).shape
);
export const ExtendedCheckoutUpdateRequestSchema = CheckoutSchema;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

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