fix: allow equivalent metadata union members - #76
Merged
damaz91 merged 1 commit intoAug 14, 2026
Merged
Conversation
damaz91
approved these changes
Aug 14, 2026
damaz91
merged commit Aug 14, 2026
35af25c
into
Universal-Commerce-Protocol:main
19 of 20 checks passed
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
normalize_metadata_schemas()synthesizes a root union forucp.jsonusingoneOf:response_cart_schema,response_catalog_schema, andresponse_order_schemahave the same validation shape; their differences are limited to annotations such astitleanddescription. Any metadata instance matching one of these response profiles therefore matches all three, so the generatedoneOfrejects it for matching more than one branch.Fix: synthesize the metadata type union with
anyOf. This preserves the existing member list while allowing equivalent response profiles, matching the generated PydanticUnionbehavior.Category (Required)
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Related Issues
Fixes #73
Checklist
!for breaking changes).Screenshots / Logs (if applicable)
oneOfreturns one validation error for equivalent response members;anyOfreturns zero.uv run python -m unittest discover -s tests -p 'test_*.py'— 77 passed../generate_models.sh 2026-04-08— completed; no model behavior diff.uvx pre-commit run --all-files— passed.git diff --check— passed.