Skip to content

fix(shopping): include extra catalog metadata fields in JSON output - #323

Merged
jpage-godaddy merged 1 commit into
mainfrom
shopping-metadata
Oct 14, 2026
Merged

jpage-godaddy merged 1 commit into
mainfrom
shopping-metadata

Conversation

@jpage-godaddy

Copy link
Copy Markdown
Collaborator

What changes for users

shopping catalog search, get and lookup with --output json now include product and variant metadata fields the catalog returns beyond the documented ones. For example, email products now show subscription_type. Previously these fields were dropped, so scripts and AI assistants could not see them.

The human-readable views are unchanged. Other shopping responses (checkout, fulfillment) are unchanged and still omit fields their schemas do not name.

How

The Shopping contract declares product and variant metadata as open objects, but the generated client kept only the documented fields. The type generator only keeps leftover fields for an open object written as additionalProperties: {}, which means the same thing as true.

generate-api-catalog now rewrites the six catalog metadata schemas that way when it refreshes shopping.oas3.json, so the generated types gain a catch-all map. The refresh fails if one of those schemas disappears from the contract. Request-side schemas are deliberately left alone: a catch-all field would also be required wherever the CLI builds them by hand, and nothing the CLI sends changes.

shopping.oas3.json was regenerated with the tool; the diff is exactly those six rewrites.

Testing

  • New round-trip test in shopping-client: a response with subscription_type, number_of_terms and term_type keeps them after decode and encode. It fails against the previous spec.
  • New unit tests for the refresh step, including that request-side schemas are untouched.
  • cargo check, cargo clippy -D warnings, cargo fmt --check, check-module-size.sh and cargo test --workspace all pass.
  • Checked by hand against a test environment: subscription_type appears for email products.

🤖 Generated with Claude Code

`shopping catalog search`, `get` and `lookup` now include product and variant
metadata fields the catalog returns beyond the documented ones, such as
`subscription_type` on email products. Previously these fields were missing
from `--output json`.

Other shopping responses are unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation is narrowly scoped, consistent with the stated behavior, and adequately tested.

0 open findings

What changed in this PR

Preserves undocumented catalog metadata in JSON output for shopping search, get, and lookup commands.

Changes:

  • Rewrites six open metadata schemas for Progenitor catch-all generation.
  • Regenerates the Shopping OpenAPI specification.
  • Adds refresh and serialization round-trip tests.
File Description
rust/​tools/​generate-api-catalog/​src/​shopping_spec.rs Adds targeted schema normalization and tests.
rust/​shopping-client/​src/​lib.rs Tests unknown metadata preservation.
rust/​shopping-client/​openapi/​shopping.oas3.json Applies the six generated schema rewrites.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jpage-godaddy
jpage-godaddy merged commit c85ec66 into main Oct 14, 2026
6 checks passed
@jpage-godaddy
jpage-godaddy deleted the shopping-metadata branch October 14, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants