Generating typed request/response variants from v2026-04-08 schemas #373
marcomontalbano
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We've been working on generating Zod/TypeScript models from the new JSON Schema (v2026-04-08) and found it significantly more complex than with the previous schema layout.
With the old approach, explicit request/response schema files made code generation straightforward.
quicktypecould produce Zod schemas with minimal custom logic.The new schemas introduce a few challenges:
1. Request/response variants are now derived from metadata annotations, not separate files.
Instead of dedicated
*_request.json/*_response.jsonfiles, field-level rules are embedded inline usingucp_request:This means a generator must interpret per-operation rules to reconstruct what was previously an explicit schema file.
2.
ucp_requestrules appear in nested objects.The annotations aren't limited to top-level checkout properties, they also appear in nested types like
line_item,fulfillment_method, andfulfillment_group. A generator that only handles the top level will produce incorrect schemas.Having distinct Zod schemas for
CreateCheckoutRequestandCreateCheckoutResponseis particularly useful when passing them asinputSchemaandoutputSchemaof an MCP tool.Has anyone found a clean approach to this?
Beta Was this translation helpful? Give feedback.
All reactions