fix: generate capability declaration schemas - #67
Merged
carolinerg1 merged 1 commit intoSep 4, 2026
Merged
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
vishkaty
force-pushed
the
fix/project-credential-identity-defs
branch
from
August 31, 2026 17:17
04b5797 to
eaf3eae
Compare
vishkaty
force-pushed
the
fix/project-credential-identity-defs
branch
from
September 1, 2026 14:09
eaf3eae to
49c81ca
Compare
A capability may redeclare the platform_schema, business_schema and response_schema roles that capability.json defines, under a $defs key equal to its own reverse domain name. Nothing in the --src list reaches those declarations, and handing the file to quicktype whole generates nothing for them either: these files are bare $defs containers with no root type, properties or $ref, so quicktype generates only what the root references, drops the rest, and exits 0. The omission is silent. Four files declare this way at 2026-08-25: common/identity_linking.json, shopping/fulfillment.json, shopping/permalink.json and common/payment_split_payments.json. None of their declarations were generated. Discovery is keyed on the shape, never on file names, so a capability added later is picked up with no edit here. The declarations are generated in their own isolated quicktype invocation and merged, which leaves the main invocation's inputs untouched so existing export names cannot move. The generated change is additive only: no existing line is changed, moved or removed. quicktype structurally unifies declarations that differ only in annotations, keeping one title's name. A completeness gate re-derives the declaration set from the schema tree independently of discovery, aliases any unified away name to its surviving structural sibling, and fails the build if a declaration produced nothing.
vishkaty
force-pushed
the
fix/project-credential-identity-defs
branch
from
September 3, 2026 00:44
49c81ca to
f0cafb3
Compare
This was referenced Sep 3, 2026
carolinerg1
approved these changes
Sep 4, 2026
carolinerg1
merged commit Sep 4, 2026
1dd6de1
into
Universal-Commerce-Protocol:main
15 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.
Summary
Re-derived 2026-09-02 against current main 688b627 (v0.5.1) and reduced to one
change. Head f0cafb3.
This PR originally carried two fixes. #61 superseded the first: generate_models.sh
now globs schemas/common/types/*.json at lines 191 to 193, so the four payment
credential subtype files generate without this PR. Thank you to @segiodongo, and
a glob rather than a list of names means later common/types files are covered
too. That half is withdrawn.
What remains is capability declaration schemas.
Observed
A capability may redeclare the platform_schema, business_schema and
response_schema roles that capability.json defines, under a $defs key equal to
its own reverse domain name. No path in generate_models.sh reaches those
declarations.
Handing the file to quicktype whole does not help. These files are bare $defs
containers with no root type, no properties and no root $ref, so quicktype
generates only what the root references, drops the rest, and exits 0. The
omission is silent.
Measured on 688b627, four files declare this way and none of their declarations
were generated:
$defs/scope_policy at generate_models.sh:149 to 151. Those two do generate.
The platform_schema and business_schema in the same file generate nothing.
Permalink appears 0 times in src/spec_generated.ts.
update and response variants are, as $defs/checkout attachments.
$defs/payment_instrument and $defs/checkout. Its config content does reach the
output separately through common/types/business_split_payments_config.json, so
the effect there is smaller than for the other three.
Expected
The declarations generate the way other capability shapes do.
The change
Discovery is keyed on the shape, never on file names, so a capability added to
the spec later is picked up with no edit to this repo.
The declarations are generated in their own isolated quicktype invocation and
merged. That matters: quicktype assigns names globally across one invocation, so
adding sources to the shared invocation re-picks disambiguating names for
unrelated existing types. An earlier attempt did exactly that and renamed
DescriptionClassSchema and MultiDestinationSchema, which is a breaking change to
the public API. Isolation removes that possibility by construction rather than by
inspection.
quicktype structurally unifies declarations that differ only in annotations and
keeps one title name, so identity_linking and permalink platform declarations
collapse to one type. A completeness gate re-derives the declaration set from the
schema tree independently of discovery, aliases any unified away name to its
surviving structural sibling, and fails the build if a declaration produced
nothing. The gate runs unconditionally: guarding it on whether discovery found
anything would make it blind to discovery finding nothing, which is the precise
failure quicktype exit 0 produces.
Verification
Re-measured 2026-09-02 on f0cafb3, based on main 688b627:
line is changed, moved or removed, and 307 exports become 318. Three of the
four inserted hunks land mid file because the normalizer places aliases next to
their targets, so this is additive rather than strictly appended.
bytes, and byte identical to the committed file, so the drift job stays green.
missed declarations, rather than exiting 0 as it does today.
One rough edge, stated rather than hidden: when the gate fails, src/spec_generated.ts
has already been written by the normalize step, so a failed run leaves that file
modified. Regeneration restores it byte identically.
Thank you to @ptiper for flagging the capability $defs gaps in the #61 review and
asking for tracking issues so the remainder could land right after 0.5.0.
Fixes #66