Skip to content

decouple NamingStrategy from C2J Shape via ShapeContext#7133

Open
Fred1155 wants to merge 2 commits into
feature/master/smithy-migrationfrom
bole/refactoring_name_strategy
Open

decouple NamingStrategy from C2J Shape via ShapeContext#7133
Fred1155 wants to merge 2 commits into
feature/master/smithy-migrationfrom
bole/refactoring_name_strategy

Conversation

@Fred1155

Copy link
Copy Markdown
Contributor

Motivation and Context

NamingStrategy takes software.amazon.awssdk.codegen.model.service.Shape (a C2J type) in seven of its methods. The strategy only reads five predicates from that parameter (isUnion, isException, isOrContainsEnum, isList, isMap). Coupling the interface to a specific model type would force any non-C2J caller to fabricate a Shape just to satisfy the signature.

Modifications

  • New ShapeContext interface exposing the five predicates the strategy actually reads.
  • NamingStrategy methods now take ShapeContext in place of Shape.
  • DefaultNamingStrategy updated to read predicates via ShapeContext; algorithm unchanged.
  • AddShapes (the only caller) wraps its Shape via ShapeContext.ofC2j(shape, allShapes) at the call site.
  • NamingStrategy is codegen-internal, not @SdkPublicApi, and codegen/ is excluded from japicmp — no public API impact.

Testing

  • ShapeContextTest verifies ofC2j wires each predicate to the correct backing accessor and that isOrContainsEnum recurses through allShapes for list/map members.
  • Existing DefaultNamingStrategyTest cases updated to the new signature; behavior assertions unchanged.
  • mvn clean install -pl :codegen passes.

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 July 10, 2026 22:33
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.

1 participant