feat: support capability extensions in codegen and cart-to-checkout conversion - #81
Closed
damaz91 wants to merge 2 commits into
Closed
Conversation
…onversion - Generate request variants across all capability extension $defs in preprocess_schemas.py - Inject _enforce_cart_conversion validator in postprocess_models.py to allow cart_id or line_items in cart checkout creation - Fix trailing comma issue when injecting AfterValidator into multiline Annotated aliases - Add CapabilityExtensionSemanticTest to test_codegen_pipeline.py - Regenerate models against UCP version 2026-04-08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds native capability extension support directly into the Python SDK codegen pipeline:
preprocess_schemas.pyso that request variants (*_create_request.json,*_update_request.json,*_complete_request.json) are generated across all capability extensions in$defs(such ascart.json,fulfillment.json,discount.json,buyer_consent.json).cart_create_request.Checkout: addscart_idand relaxesline_itemsto optional.fulfillment_create_request.Checkout/fulfillment_update_request.Checkout: addsfulfillment.discount_create_request.Checkout/discount_create_request.Cart/discount_update_request.*: addsdiscounts.buyer_consent_create_request.Checkout/buyer_consent_update_request.Checkout: addsbuyer.@model_validator(mode="after")(_enforce_cart_conversion) intocart_create_request.Checkoutinpostprocess_models.pyto enforce that eithercart_idorline_itemsis provided.AfterValidator(...)into multilineAnnotatedaliases to prevent syntax errors during formatting.Category (Required)
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Related Issues
N/A
Checklist
!for breaking changes).