Repository navigation
Conversation
gsmith85
added a commit
that referenced
this pull request
Oct 1, 2026
Implement Task 4 (PR 1d) of the ucp-schema codegen pipeline: - Wire Commands::GenerateTypes in src/bin/ucp-schema.rs with --profile, --capability, --extension, --schema-dir (alias --schema-local-base), --schema-remote-base, --output, and --pretty. - Implement CliExitCode for CodegenError and generalize write_json_output to <T: serde::Serialize + ?Sized>. - Add CLI integration tests in tests/generate_types_test.rs covering stdout pretty/compact output, file output, repeatable/comma-delimited flags, and error exit codes. Stacked PR Roadmap: - PR 1a (#81): Identifier qualification, UCP keyword stripping, $ref rewriting - PR 1b (#82): Directional schema slicing and $ref alignment - PR 1c (#83): Capability/extension reachability, composition, and generate_types() library API - PR 1d (this PR): CLI generate-types subcommand - PR 2: Self-contained .well-known/ucp --profile scoping - PR 3: Inline conditional variant hoisting and ordered anyOf union lowering - PR 4: OpenAPI 3.1 REST binding assembly (generate-openapi)
gsmith85
added a commit
that referenced
this pull request
Oct 1, 2026
Implement Task 4 (PR 1d) of the ucp-schema codegen pipeline: - Wire Commands::GenerateTypes in src/bin/ucp-schema.rs with --profile, --capability, --extension, --schema-dir (alias --schema-local-base), --schema-remote-base, --output, and --pretty. - Implement CliExitCode for CodegenError and generalize write_json_output to <T: serde::Serialize + ?Sized>. - Add CLI integration tests in tests/generate_types_test.rs covering stdout pretty/compact output, file output, repeatable/comma-delimited flags, and error exit codes. Stacked PR Roadmap: - PR 1a (#81): Identifier qualification, UCP keyword stripping, $ref rewriting - PR 1b (#82): Directional schema slicing and $ref alignment - PR 1c (#83): Capability/extension reachability, composition, and generate_types() library API - PR 1d (this PR): CLI generate-types subcommand - PR 2: Self-contained .well-known/ucp --profile scoping - PR 3: Inline conditional variant hoisting and ordered anyOf union lowering - PR 4: OpenAPI 3.1 REST binding assembly (generate-openapi)
gsmith85
added a commit
that referenced
this pull request
Oct 1, 2026
Implement Task 4 (PR 1d) of the ucp-schema codegen pipeline: - Wire Commands::GenerateTypes in src/bin/ucp-schema.rs with --profile, --capability, --extension, --schema-dir (alias --schema-local-base), --schema-remote-base, --output, and --pretty. - Implement CliExitCode for CodegenError and generalize write_json_output to <T: serde::Serialize + ?Sized>. - Add CLI integration tests in tests/generate_types_test.rs covering stdout pretty/compact output, file output, repeatable/comma-delimited flags, and error exit codes. Stacked PR Roadmap: - PR 1a (#81): Identifier qualification, UCP keyword stripping, $ref rewriting - PR 1b (#82): Directional schema slicing and $ref alignment - PR 1c (#83): Capability/extension reachability, composition, and generate_types() library API - PR 1d (this PR): CLI generate-types subcommand - PR 2: Self-contained .well-known/ucp --profile scoping - PR 3: Inline conditional variant hoisting and ordered anyOf union lowering - PR 4: OpenAPI 3.1 REST binding assembly (generate-openapi)
gsmith85
force-pushed
the
feat/codegen-slicing
branch
from
October 1, 2026 23:45
b6fcada to
88c578b
Compare
gsmith85
added a commit
that referenced
this pull request
Oct 1, 2026
Implement Task 4 (PR 1d) of the ucp-schema codegen pipeline: - Wire Commands::GenerateTypes in src/bin/ucp-schema.rs with --profile, --capability, --extension, --schema-dir (alias --schema-local-base), --schema-remote-base, --output, and --pretty. - Implement CliExitCode for CodegenError and generalize write_json_output to <T: serde::Serialize + ?Sized>. - Add CLI integration tests in tests/generate_types_test.rs covering stdout pretty/compact output, file output, repeatable/comma-delimited flags, and error exit codes. Stacked PR Roadmap: - PR 1a (#81): Identifier qualification, UCP keyword stripping, $ref rewriting - PR 1b (#82): Directional schema slicing and $ref alignment - PR 1c (#83): Capability/extension reachability, composition, and generate_types() library API - PR 1d (this PR): CLI generate-types subcommand - PR 2: Self-contained .well-known/ucp --profile scoping - PR 3: Inline conditional variant hoisting and ordered anyOf union lowering - PR 4: OpenAPI 3.1 REST binding assembly (generate-openapi)
gsmith85
force-pushed
the
feat/codegen-compile-types
branch
from
October 1, 2026 23:45
19346d4 to
1ab4348
Compare
gsmith85
added a commit
that referenced
this pull request
Oct 2, 2026
Implement Task 4 (PR 1d) of the ucp-schema codegen pipeline: - Wire Commands::GenerateTypes in src/bin/ucp-schema.rs with --profile, --capability, --extension, --schema-dir (alias --schema-local-base), --schema-remote-base, --output, and --pretty. - Implement CliExitCode for CodegenError and generalize write_json_output to <T: serde::Serialize + ?Sized>. - Add CLI integration tests in tests/generate_types_test.rs covering stdout pretty/compact output, file output, repeatable/comma-delimited flags, and error exit codes. Stacked PR Roadmap: - PR 1a (#81): Identifier qualification, UCP keyword stripping, $ref rewriting - PR 1b (#82): Directional schema slicing and $ref alignment - PR 1c (#83): Capability/extension reachability, composition, and generate_types() library API - PR 1d (this PR): CLI generate-types subcommand - PR 2: Self-contained .well-known/ucp --profile scoping - PR 3: Inline conditional variant hoisting and ordered anyOf union lowering - PR 4: OpenAPI 3.1 REST binding assembly (generate-openapi)
gsmith85
added a commit
that referenced
this pull request
Oct 2, 2026
Implement Task 4 (PR 1d) of the ucp-schema codegen pipeline: - Wire Commands::GenerateTypes in src/bin/ucp-schema.rs with --profile, --capability, --extension, --schema-dir (alias --schema-local-base), --schema-remote-base, --output, and --pretty. - Implement CliExitCode for CodegenError and generalize write_json_output to <T: serde::Serialize + ?Sized>. - Add CLI integration tests in tests/generate_types_test.rs covering stdout pretty/compact output, file output, repeatable/comma-delimited flags, and error exit codes. Stacked PR Roadmap: - PR 1a (#81): Identifier qualification, UCP keyword stripping, $ref rewriting - PR 1b (#82): Directional schema slicing and $ref alignment - PR 1c (#83): Capability/extension reachability, composition, and generate_types() library API - PR 1d (this PR): CLI generate-types subcommand - PR 2: Self-contained .well-known/ucp --profile scoping - PR 3: Inline conditional variant hoisting and ordered anyOf union lowering - PR 4: OpenAPI 3.1 REST binding assembly (generate-openapi)
gsmith85
force-pushed
the
feat/codegen-compile-types
branch
from
October 2, 2026 16:37
a85a726 to
8cac42b
Compare
gsmith85
force-pushed
the
feat/codegen-slicing
branch
from
October 2, 2026 16:37
88c578b to
4ed1ea1
Compare
This was referenced Oct 2, 2026
gsmith85
force-pushed
the
feat/codegen-slicing
branch
from
October 7, 2026 06:00
4ed1ea1 to
7b74335
Compare
gsmith85
force-pushed
the
feat/codegen-compile-types
branch
from
October 7, 2026 06:00
8cac42b to
9d93d16
Compare
This was referenced Oct 7, 2026
Open
gsmith85
force-pushed
the
feat/codegen-slicing
branch
from
October 7, 2026 22:04
7b74335 to
9380b3c
Compare
gsmith85
force-pushed
the
feat/codegen-compile-types
branch
from
October 7, 2026 22:04
9d93d16 to
33ec2f4
Compare
…_types() API Implement Task 3 (PR 1c) of the ucp-schema codegen pipeline: - Stage 1 (src/codegen/reachability.rs): Schema discovery, short/reverse-domain capability and extension selection, extension reclassification, ambient protocol root seeding, and transitive $ref reachability closure with inactive extension $defs pruning. - Stage 2 (src/codegen/hoist.rs): Upfront $defs hoisting, pure re-export skipping, self-named role container extraction (*PlatformSchema, *BusinessSchema, *ResponseSchema), and collision-aware parent qualification. - Stage 3 (src/codegen/compose.rs): Active extension composition into root capabilities, in-place standalone sub-type overlays (Buyer, Payment, PaymentInstrument, Cart->Checkout), and container capability operations (both nested $defs and oneOf/allOf shapes). - Stages 5, 6, 8 & Public API (src/codegen/mod.rs, src/lib.rs): Directional slicing, $ref alignment, empty-object pruning (retaining ErrorResponse), and public GenerateTypesOptions, TypesBundleDoc, CompiledTypes, CodegenError, compile_types(), and generate_types() APIs. Stacked PR Roadmap: - PR 1a (#81): Identifier qualification, UCP keyword stripping, $ref rewriting - PR 1b (#82): Directional schema slicing and $ref alignment - PR 1c (this PR): Capability/extension reachability, composition, and generate_types() library API - PR 2: CLI generate-types subcommand and --profile loading - PR 3: Inline conditional variant hoisting and ordered anyOf union lowering - PR 4: OpenAPI 3.1 REST binding assembly (generate-openapi)
…onse-only allOf branches in request slices
…uilder, and guard --profile
…nd extension matching
…st/UpdateRequest slices
…itional items, and prune dead defs
…inactive_local_defs
gsmith85
force-pushed
the
feat/codegen-slicing
branch
from
October 8, 2026 00:32
9380b3c to
e626830
Compare
gsmith85
force-pushed
the
feat/codegen-compile-types
branch
from
October 8, 2026 00:32
33ec2f4 to
31aae2f
Compare
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
Implements Task 3 (PR 1c) of the two-layer
ucp-schemacode-generation pipeline: capability/extension reachability discovery,$defshoisting & collision qualification, extension composition, and the publiccompile_types()/generate_types()library API.Pipeline Stages Added
src/codegen/reachability.rs):.jsonschemas in--schema-dirusing schema structure (name/versioncapability identity,extendsmetadata,ucp_request/ucp_responsedirectional annotations, and$defsreverse-domain parent inference), supports short-name (checkout) and reverse-domain (dev.ucp.shopping.checkout) matching, reclassifies extension schemas passed via--capability, seeds ambient protocol roots (profile,ucp,capability,service,payment_handler,error_response), and computes the transitive$refclosure while pruning inactive extension$defs.src/codegen/hoist.rs):$defsentries into the top-level$defsbundle, skips pure re-exports, extracts self-named capability role schemas (*PlatformSchema,*BusinessSchema,*ResponseSchema), and parent-qualifies colliding local$defs(PaymentAp2MandateErrorCode,JsonrpcErrorResponse,A2aMessageMessage).src/codegen/compose.rs):Buyer,Payment,PaymentInstrument,Cart->Checkout), and container capability operations (CatalogSearch*,CatalogLookup*, supporting both nested$defsandoneOf/allOfextension shapes).src/codegen/mod.rs,src/lib.rs):$refalignment, and empty-object pruning (retainingErrorResponseand definitions referenced via$refanywhere in$defsor rootproperties), and exposesGenerateTypesOptions,TypesBundleDoc,CompiledTypes,CodegenError,compile_types(), andgenerate_types().Stacked PR Series Roadmap
$refrewriting (src/codegen/normalizer.rs)$refalignment (src/codegen/normalizer.rs)generate_types()library API (src/codegen/{mod,reachability,hoist,compose}.rs)generate-typessubcommand (src/bin/ucp-schema.rs,tests/generate_types_test.rs).well-known/ucp--profilescoping (src/codegen/profile.rs)src/codegen/normalizer.rs,src/codegen/reify.rs)<Union>Base) (src/codegen/reify.rs)src/codegen/reify.rs)generate_models.sh,postprocess_models.py,src/ucp_sdk/models/)generate_models.sh,scripts/generate-zod-from-types.mjs,src/spec_generated.ts)ucp-schema generate-openapi,src/openapi/mod.rs)Test Plan
cargo fmt --checkcargo test --all-targetscargo clippy --all-targets -- -D warnings