Skip to content

decouple NamingStrategy from C2J Shape via ShapeContext#7133

Merged
Fred1155 merged 4 commits into
feature/master/smithy-migrationfrom
bole/refactoring_name_strategy
Jul 15, 2026
Merged

decouple NamingStrategy from C2J Shape via ShapeContext#7133
Fred1155 merged 4 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
Comment thread codegen/src/main/java/software/amazon/awssdk/codegen/naming/ShapeContext.java Outdated
@Fred1155 Fred1155 merged commit 150acdc into feature/master/smithy-migration Jul 15, 2026
3 of 4 checks passed
@Fred1155 Fred1155 deleted the bole/refactoring_name_strategy branch July 15, 2026 16:44
@github-actions

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants