fix: label array items by type instead of "any" in schema reference#552
Open
sakinaroufid wants to merge 2 commits into
Open
fix: label array items by type instead of "any" in schema reference#552sakinaroufid wants to merge 2 commits into
sakinaroufid wants to merge 2 commits into
Conversation
When an array property's items were defined via allOf, or had their $ref inlined during schema resolution, the reference table generator could not read a simple item type and rendered the cell as "Array[any]". This was live for totals in every extension capability table (AP2, buyer consent, discount, fulfillment, split payments) and for products in catalog lookup, even though those fields are unchanged from the base schemas, where they render correctly as Array[Total] and Array[Product]. Recover the item label from the item type, a $ref link, or a title (also checking allOf branches), falling back to object. After rebuilding the spec, all 11 affected cells render Array[Total] or Array[Product], and a full before/after diff of every rendered type cell shows no other change.
damaz91
approved these changes
Jun 26, 2026
damaz91
left a comment
Contributor
There was a problem hiding this comment.
Thanks @sakinaroufid - LGTM
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 reference tables show
Array[any]in the Type column for some array fields, even though those same fields render with a real type elsewhere on the site.Why it matters: the Type column is where a reader checks what a field holds. For
totalson every extension capability (AP2 Mandate, Buyer Consent, Discount, Fulfillment, Split Payments) it showsArray[any], and forproductsin catalog lookup it showsArray[any]. Those same fields render correctly asArray[Total]andArray[Product]in the base schemas, and none of the extensions change the field, so a reader gets a worse, blank answer in exactly the places that build on the base.Cause: the table generator labels an array from
items.$refor a plainitems.type. When the item is defined throughallOf, or its$refwas inlined while the schema was resolved, neither is present, so it fell back toany. The base tables keep the$ref, which is why they render fine.Fix: when the simple cases do not apply, recover the item label from the item type, a
$reflink, or a title (including titles onallOfbranches), and fall back toobjectrather thanany.Category (Required)
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Related Issues
None.
Checklist
!for breaking changes).main.pyhas no test harness in the repo; verified by rebuilding the spec and diffing every rendered Type cell before and after (1900 cells, 11 changed, 0 regressions). Happy to add a harness if maintainers want one.Screenshots / Logs (if applicable)
Rendered Type cells before and after, from a full rebuild of the spec.
Before:
After:
A diff of every rendered Type cell across the whole spec confirms exactly 11 cells changed, all
Array[any]toArray[Total]orArray[Product], with no other cell affected.