Read endpoint rule-set and tests from Smithy traits - #7296
Open
Fred1155 wants to merge 2 commits 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
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.jsonis now a complete input for everything the builder produces.Endpoint resolution is unchanged. The generated
EndpointProvider,EndpointParametersand endpoint test classes still come from the existingpoet/rules*emitters readingIntermediateModel.getEndpointRuleSetModel(). Only the source of that model changes.Modifications
smithy/AddSmithyEndpoints.java@endpointRuleSet/@endpointTestsSmithyIntermediateModelBuilder.javaSmithyModels.javaGenerationMojo.javaThe extraction is a parse rather than a translation. The trait content already uses the schema
EndpointRuleSetModelandEndpointTestSuiteModelexpect, so it goes through the sameJacksonmapper the sidecar path uses.SmithyModelsis now down tomodelandcustomizationConfig. Still worth keeping as theC2jModelscounterpart 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
AddSmithyEndpointsTestcovers trait present, trait absent for each of the two models, and that parametertypekeeps the traits' lower-case form — the traits write"string"where the sidecars write"String", and every consumer lower-cases before switching on it.SmithyIntermediateModelBuilderTestcovers 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
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License