Skip to content

Apply model sharing and name validation in Smithy codegen - #7310

Open
Fred1155 wants to merge 1 commit into
feature/master/smithy-migrationfrom
bole/read_smithy_naming_settings
Open

Apply model sharing and name validation in Smithy codegen#7310
Fred1155 wants to merge 1 commit into
feature/master/smithy-migrationfrom
bole/read_smithy_naming_settings

Conversation

@Fred1155

Copy link
Copy Markdown
Contributor

Motivation and Context

DefaultSmithyNamingStrategy ignored two customization settings that DefaultNamingStrategy reads, so the Smithy codegen path diverged from C2J in two ways:

  • Model sharing (shareModelConfig) was dropped, producing wrong package names for services that share another service's models. Blocks migrating DynamoDB, since dynamodbstreams shares its models.
  • Name validation (underscoresInNameBehavior, allowedUnderscoreNames) did not run at all, validateCustomerVisibleNaming was an empty body that build() already called.

Modifications

Route the twelve package-name methods through the shareModelConfig redirect, matching C2J's two mechanisms: ten nest under the shared service (dynamodb.streams), while the model and transform packages are shared outright (dynamodb.model). concatServiceNameIfShareModel keys off the presence of shareModelConfig rather than of shareModelWith, reproducing C2J including that asymmetry so the two paths cannot generate different package names.

Port validateCustomerVisibleNaming, and add the customizationConfig null guard the C2J constructor has — unnecessary while the field was unread, and both changes read it.

No change to the C2J path.

Testing

mvn install on codegen and codegen-maven-plugin: 822 tests pass, checkstyle and SpotBugs clean. Parity harness and endpoint-sidecar suites unaffected.

DefaultSmithyNamingStrategyTest goes from 8 tests to 51:

  • All twelve package methods asserted against DefaultNamingStrategy under 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.
  • Six validation tests: the underscore rule, the ALLOW opt-out, the allowlist in both directions, a non-identifier name, and an idiomatic name.

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.
  • 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 24, 2026 07:08
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