Skip to content

Add AddSmithyShapes base class to translate Smithy shapes into the codegen intermediate model - #7218

Open
Fred1155 wants to merge 5 commits into
feature/master/smithy-migrationfrom
bole/add_smithy_shape_base_v2
Open

Add AddSmithyShapes base class to translate Smithy shapes into the codegen intermediate model#7218
Fred1155 wants to merge 5 commits into
feature/master/smithy-migrationfrom
bole/add_smithy_shape_base_v2

Conversation

@Fred1155

@Fred1155 Fred1155 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

This is part of the incremental migration of the code generator from the C2J model to Smithy as the source of truth for the intermediate model. The existing C2J path builds ShapeModel/MemberModel objects from C2J shapes;
the Smithy path needs an equivalent that produces the same IM from a SmithtModel.

This PR adds the shared, protocol-aware base class that does that shape/member translation. It is the foundation the concrete shape processors (input, output, exception, and model shapes) will extend in a follow-up PR. The goal
throughout is C2J parity: given the same API, the Smithy-derived IM should match what the C2J path produces today.

Modifications

  • AddSmithyShapes (new, abstract): shared base for the Smithy shape processors. Two entry points:
    • generateShapeModel(...) builds a ShapeModel and all of its members, setting shape-level metadata from traits (documentation, deprecation, XML namespace, error/fault, retryable/throttling) and from shape kind (union, event stream, string-enum values).
    • generateMemberModel(...) builds a single MemberModel (names via the naming strategy, type via TypeUtils, timestamp format, sensitivity, idempotency token, event header/payload, context param, list/map models, and HTTP mapping).
    • Delegates to the Smithy libraries where they already compute a fact rather than re-deriving it: HttpBindingIndex for HTTP bindings, TopDownIndex for reachable operations, and @required membership for the required list/flag (matching C2J semantics rather than Smithy's richer nullability).
    • Handles a few known C2J-vs-Smithy differences explicitly, with comments.
  • SmithyWireNames (new): resolves per-protocol marshallLocationName / unmarshallLocationName for a member — the Smithy counterpart to C2J'sderive*LocationName. Applies the name-override trait (@xmlName / @jsonName), then the HTTP binding location name, then the member name; EC2 has its own rule (@ec2QueryName, else first-character upper-casing), and synthetic list/map elements keep their literal lower-case names.
  • codegen/pom.xml: add the smithy-rules-engine dependency, needed forContextParamTrait.

Scope note: the base class is not yet invoked by production code generation. it is exercised only by the unit tests below. The concrete subclasses and their registration into the processor chain come in a follow-up PR, so there is no change to any generated SDK output in this change.

Testing

  • AddSmithyShapesShapeModelTest (13 tests): shape-level translation.
  • AddSmithyShapesMemberModelTest (30 tests): member-level translation.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@Fred1155
Fred1155 requested a review from a team as a code owner August 3, 2026 21:05
Comment thread codegen/src/main/java/software/amazon/awssdk/codegen/smithy/AddSmithyShapes.java Outdated
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.

2 participants