Repository navigation
Translate waiters on the Smithy path - #7512
Merged
Merged
Conversation
The Smithy builder passed an empty waiter map, so no waiters were generated from a Smithy model. AddSmithyWaiters translates each @Waitable waiter into the WaiterDefinition the C2J loader produces: delay from minDelay, and each acceptor mapped to the C2J matcher that generates the same Java. errorType is copied as written, as C2J matches the wire error code. Smithy waiters have no attempt limit, so a new codegen trait, waiterOverrides, gives maxAttempts for every waiter and fails the build when it is missing. An entry with delay and acceptors replaces the @Waitable waiter, for waiters it cannot express (HTTP status matchers), and skip drops it. smithy-waiters moves to compile scope. On the plugin classpath without it, model assembly drops @Waitable with only a warning.
jencymaryjoseph
approved these changes
Nov 11, 2026
| import software.amazon.smithy.model.shapes.ServiceShape; | ||
| import software.amazon.smithy.model.shapes.ShapeId; | ||
|
|
||
| class AddSmithyWaitersTest { |
Contributor
There was a problem hiding this comment.
Do we have tests covering duplicate waiter names across operations, unsupported/unknown smithy matchers and verification of their exception messages?
Contributor
Author
There was a problem hiding this comment.
The unsupported matchers have tests that check their messages. We have no tests for duplicate-name and unknown matcher, since Smithy rejects it during model validation.
… into bole/smithy_waiters # Conflicts: # codegen/src/main/java/software/amazon/awssdk/codegen/smithy/SmithyIntermediateModelBuilder.java
Fred1155
merged commit Nov 11, 2026
328f7de
into
feature/master/smithy-migration
5 of 6 checks passed
|
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. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Motivations
In the Smithy path, the intermediate model had no waiters, so a client generated from Smithy had no waiter classes or
waiter()method. This PR translates Smithy's@waitabletrait, following the same approach as the paginator PR #7463.@waitablecan't express three thingswaiters-2.jsonhas:maxAttempts; Smithy waiters have none.waiters-2.jsonhave no@waitablecounterpart.For these, a new codegen trait,
software.amazon.awssdk.codegen#waiterOverrides, sits on the operation, keyed by waiter name. Each entry is one of:maxAttemptsalone: translate the@waitablewaiter with this limit.maxAttempts,delayandacceptors: use thiswaiters-2.jsonwaiter instead.skip: true: generate no waiter.Like
paginatorOverride, it is applied throughsmithy-build.json, somodel.jsonis not edited.Modifications
waiterOverridestrait: defined inaws-sdk-java-codegen-traits.smithy, with the classWaiterOverridesTraitregistered as aTraitService. An invalid entry fails when the trait is loaded.AddSmithyWaiters: builds the waiter map, keyed by waiter name.A
skipentry drops the waiter; a full entry is used as written; otherwise the@waitablewaiter is translated.Delay is
minDelay(Smithy's default of 2 when absent).maxAttemptscomes from the override.maxDelay, documentation and deprecation are dropped.Matchers map as follows:
success: true/success: falseerror, expectedfalse/trueerrorTypeerror, type copied as writtenoutputwithstringEquals/booleanEqualspathoutputwithallStringEquals/anyStringEqualspathAll/pathAnyinputOutput, or anerrorTypewith a shape IDGeneration fails, with a message naming the waiter, when a waiter has no
maxAttemptsor amaxAttempts-only entry has no@waitablewaiter.SmithyIntermediateModelBuilder: passes the waiter map into the intermediate model.codegen/pom.xml:smithy-waitersmoves from runtime to compile scope, becauseAddSmithyWaitersuses its classes.Waiters are ordered by name, so some clients list waiter methods in a different order than on C2J. Behavior is the same.
Not in this PR:
waiterOverridesentries fromwaiters-2.jsonintosmithy-build.jsonbelongs with thesmithy-build.jsongenerator, together withpaginatorOverride.Testing
mvn -o test -pl :codegen,:codegen-maven-pluginpassed.New and updated tests:
AddSmithyWaitersTest: each matcher's translation, the defaultminDelay, a full override replacing a@waitablewaiter, a full override without one,skip, and each failure case.SmithyCodegenTraitsTest: the trait loads throughTraitService, invalid entries are rejected with their messages, and the trait is rejected on a non-operation shape.AwsSdkJavaCodegenPluginTest: a@waitablewaiter and an overridden waiter generate waiter classes through smithy-build, and a@waitablewaiter withoutmaxAttemptsfails.SmithyBuildGeneratorTest(codegen-maven-plugin): the real-model test model now carries awaiterOverridesentry for its waiter, because a@waitablewaiter without one fails by design.Manual one-time check: an all-services intermediate model parity run, with the overrides written from each service's
waiters-2.json, found no waiter differences between the Smithy and C2J paths for any compared client.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