Skip to content

Read endpoint rule-set and tests from Smithy traits - #7296

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

Read endpoint rule-set and tests from Smithy traits#7296
Fred1155 wants to merge 2 commits into
feature/master/smithy-migrationfrom
bole/read_smithy_endpoints

Conversation

@Fred1155

Copy link
Copy Markdown
Contributor

Motivation and Context

The endpoint rule-set and endpoint tests were the last inputs the Smithy path still read from C2J's sidecar files. This moves them to the service's own Smithy traits, so a model.json is now a complete input for everything the builder produces.

Endpoint resolution is unchanged. The generated EndpointProvider, EndpointParameters and endpoint test classes still come from the existing poet/rules* emitters reading IntermediateModel.getEndpointRuleSetModel(). Only the source of that model changes.

Modifications

File Role
smithy/AddSmithyEndpoints.java new — reads both models from @endpointRuleSet / @endpointTests
SmithyIntermediateModelBuilder.java reads the traits instead of the container
SmithyModels.java drops both endpoint fields
GenerationMojo.java stops loading the sidecars on the Smithy branch

The extraction is a parse rather than a translation. The trait content already uses the schema EndpointRuleSetModel and EndpointTestSuiteModel expect, so it goes through the same Jackson mapper the sidecar path uses.

SmithyModels is now down to model and customizationConfig. Still worth keeping as theC2jModels counterpart and as the place paginators and waiters will go.

There is no sidecar fallback: all 426 Smithy models carry @endpointRuleSet, so the branch would be unreachable, and IntermediateModel already handles a null rule-set by substituting EndpointRuleSetModel.defaultRules(endpointPrefix). A service without the traits therefore lands on the same defaults a C2J service with no sidecar gets.

Testing

AddSmithyEndpointsTest covers trait present, trait absent for each of the two models, and that parameter type keeps the traits' lower-case form — the traits write "string" where the sidecars write "String", and every consumer lower-cases before switching on it.
SmithyIntermediateModelBuilderTest covers the wiring: the traits reaching the intermediate model, and a service without them landing on the default rules.
Also verified locally against real models, but not shipped here. EndpointSidecarEquivalenceTest builds both models from the trait and from the sidecar for greengrass, ec2, sqs, route53, sts and kendraranking and compares the parsed objects, 12/12 green. This test will be put in a separate PR to keep this PR clean to review.

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 19, 2026 20:40
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