Select the service and shapes to generate - #814
Open
jonathan343 wants to merge 3 commits into
Open
jonathan343 wants to merge 3 commits into
jonathan343 wants to merge 3 commits into
Conversation
Resolve the target service and select its reachable data shapes in model order. Support standalone types with name-conflict checks, expose selection through the CLI, and report excluded shapes without claiming generation is implemented.
jonathan343
added this pull request to stack #796
September 27, 2026 06:53
This was referenced Sep 27, 2026
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.
Note
This PR is stacked on #795 and targets
python-codegen-modelso it contains only service and shape selection. I will retarget todevelopafter #795 merges.Summary
This PR adds
--serviceto both native generator commands. An explicit ID must identify a non-mixin service; otherwise the sole non-mixin service is selected automatically. Client generation requires a service, while standalone types can operate without one.Selection follows the service's structural relationships, including resources, operation inputs/outputs/errors, and member targets. It preserves model order, handles cyclic and deep graphs, and excludes prelude shapes, mixins, trait definitions, and service/operation/resource shapes. Without a service, conflicting case-insensitive data-shape names are reported. The CLI reports how many eligible shapes lie outside the selected service closure.
The selection API and behavior are documented in
designs/codegen/selection.md.Usage
Both commands limit selection to the resolved service's reachable data shapes. When no service exists,
typesselects all eligible data shapes and rejects case-insensitive name conflicts.When the model contains multiple non-mixin services, omitting
--servicefails for both commands and lists the candidates. For example:The command exits with code 2. Pass
--service example.weather#Weatherto select that service's reachable data shapes.Additional Testing
All 434 models in
aws/api-models-awspassed an independent raw-AST traversal comparison: 119,385 selected shapes, exact ordering and exclusion counts, and matching explicit/automatic service selection. Both CLI artifacts were exercised for every service, totaling 868 invocations. This is local validation, not an external CI dependency.These models contain no mixins,
apply, or service renames, and each has only one service; those selection scenarios are covered by targeted tests. Additional local probes checked structural relationships, ordering, cycles, and deep graphs.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.