Apply model sharing and name validation in Smithy codegen - #7310
Open
Fred1155 wants to merge 1 commit into
Open
Conversation
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.
Motivation and Context
DefaultSmithyNamingStrategyignored two customization settings thatDefaultNamingStrategyreads, so the Smithy codegen path diverged from C2J in two ways:shareModelConfig) was dropped, producing wrong package names for services that share another service's models. Blocks migrating DynamoDB, sincedynamodbstreamsshares its models.underscoresInNameBehavior,allowedUnderscoreNames) did not run at all,validateCustomerVisibleNamingwas an empty body thatbuild()already called.Modifications
Route the twelve package-name methods through the
shareModelConfigredirect, matching C2J's two mechanisms: ten nest under the shared service (dynamodb.streams), while the model and transform packages are shared outright (dynamodb.model).concatServiceNameIfShareModelkeys off the presence ofshareModelConfigrather than ofshareModelWith, reproducing C2J including that asymmetry so the two paths cannot generate different package names.Port
validateCustomerVisibleNaming, and add thecustomizationConfignull guard the C2J constructor has — unnecessary while the field was unread, and both changes read it.No change to the C2J path.
Testing
mvn installoncodegenandcodegen-maven-plugin: 822 tests pass, checkstyle and SpotBugs clean. Parity harness and endpoint-sidecar suites unaffected.DefaultSmithyNamingStrategyTestgoes from 8 tests to 51:DefaultNamingStrategyunder three configs, sharing with a package name, sharing without one, and not sharing, plus one absolute-value test so a change breaking both strategies identically still fails.ALLOWopt-out, the allowlist in both directions, a non-identifier name, and an idiomatic name.Types of changes
Checklist
mvn installsucceedsLicense