fix: add op-specific example scaffolds for catalog get_product#616
Merged
carolinerg1 merged 2 commits intoJul 22, 2026
Conversation
The example validator resolves scaffolds by schema+direction+op with a direction-only fallback. get_product shares catalog_lookup.json with the lookup op but has a different payload shape (id/product vs ids/products), and never got op-specific fixtures. Every get_product example in the catalog docs therefore fell back to the lookup scaffolds and was deep-merged with lookup boilerplate before validation: requests validated carrying a stray ids array next to id, responses a stray products array next to product. This passes only because the schemas tolerate unknown properties; the examples were never validated as the payload shape they document, and any future tightening (additionalProperties/unevaluatedProperties) would fail every get_product example against data no author wrote. Add shopping_catalog_lookup_request_get_product.json and shopping_catalog_lookup_response_get_product.json so get_product examples merge into their own shape, and regression tests covering op-specific scaffold precedence, the repo fixtures' shapes, and an end-to-end fully-elided get_product example that shows the response fixture is a valid payload seed. Verified: scripts/test_validate_examples.py 48 passed, 0 failed; full corpus validation 274 passed, 0 failed, 0 errors, 31 skipped.
|
LGTM! Thanks for catching and addressing this, @sakinaroufid! Review & Verification Summary
|
damaz91
approved these changes
Jul 22, 2026
carolinerg1
approved these changes
Jul 22, 2026
Contributor
Author
|
Thanks for the review @carolinerg1 @damaz91 - does this look good to merge now, or needs TC review? |
carolinerg1
merged commit Jul 22, 2026
f29c3cb
into
Universal-Commerce-Protocol:main
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
The doc example validator merges each example into a scaffold before validating it. Scaffolds are looked up by schema + direction + op, with a fallback to a direction-only file. get_product never got its own scaffolds, so its examples fall back to the lookup ones. That's the wrong shape: lookup uses
idsandproductsarrays, get_product uses a singleidand a singleproduct.Result: every get_product example in the catalog docs is validated with a stray
idsorproductsfield merged in. It only passes because the schemas allow unknown properties. The examples aren't being checked as the shape they document, and if we ever tightenadditionalPropertieson these defs, all get_product examples break over fields nobody wrote.#516 migrated the annotations to op=search|lookup|get_product but didn't add fixtures for the new op. This adds them:
shopping_catalog_lookup_request_get_product.json: minimal seed withid.shopping_catalog_lookup_response_get_product.json: valid seed withucpand a fullproduct, same style as the checkout response scaffold.test_validate_examples.py: op-specific scaffolds win over the fallback, both fixtures have the right shape, and a fully elided get_product example validates from the response fixture alone.No schema, doc, or SDK changes.
Category (Required)
Please select one or more categories that apply to this change.
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Related Issues
None.
Checklist
!for breaking changes).Unchecked items don't apply here (no doc, schema, or SDK changes).
Screenshots / Logs (if applicable)