fix: support current UCP schema generation#16
fix: support current UCP schema generation#16sakinaroufid wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
Conversation
Project the current upstream UCP source schemas into the legacy split request and response shapes this SDK exports, then normalize quicktype output to keep the generated API stable.
|
@wry-ry tagging you here as I have submitted PR to fix schema generation |
|
Clarification: this PR fixes the repo-side schema generation issues that were causing drift against the current upstream UCP schema model while preserving the legacy generated API shape. Thanks! |
|
We hit this in production while integrating with real merchants from https://merchants.awesomeucp.com/ (Everlane, Monos, etc.). The current Filed #19 with details and reproduction steps. Would be great to get this merged — it's currently the main blocker for any JS client connecting to live UCP merchants. |
Summary
Fix
js-sdkmodel generation so it works with the current upstream UCP schema layout while keeping the existing generated SDK API intact.Context
The SDK generator was built around the older split schema layout (
*.create_req,*.update_req,*_resp). Upstream UCP has moved to unified schemas undersource/, so generation in this repo had drifted away from the actual source of truth.This change brings the generator back in line with upstream without forcing a consumer-facing API rewrite in
js-sdk.What changed
generate_models.shto handle both the legacy split layout and the current upstreamsource/layoutsrc/spec_generated.tsWhy this approach
There were two obvious ways to deal with the upstream schema changes:
This takes the second approach. The problem here is generator drift, not that the SDK suddenly needs a new public API.
Validation
Ran locally:
npm run generate -- /tmp/ucp-spec-testnpm run build:noEmitnpm run buildNotes
The largest part of the change is the projection layer. That is where the compatibility logic now lives, and it is what allows
js-sdkto keep generating the same kind of output from the current upstream schema model.