Repository navigation
Conversation
The Smithy builder passed an empty paginator map and never set isPaginated, so no paginator classes or xxxPaginator() client methods were generated from a Smithy model. AddSmithyPaginators builds the map from each operation's @paginated trait, with the service's @paginated filling the members the operation leaves out, as Smithy's PaginatedIndex does. A new codegen trait, paginatorOverride, replaces that translation for paginators @paginated cannot express (several tokens, moreResults, several result keys), or with skip, drops the paginator. The builder sets isPaginated with the rule C2J's AddOperations uses, so the client methods and paginator classes agree, and removes paginators of deprecatedOperations as the C2J builder does.
This branch has not been deployed
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
For now on the Smithy path, the step that builds the intermediate model passed an empty paginator map and never marked an operation as paginated. So a client generated from a Smithy model had no paginator classes (such as
ListThingsIterableandListThingsPublisher) and nolistThingsPaginator(...)client methods.This PR fills that gap. Smithy describes pagination with the
@paginatedtrait on an operation, for example:@paginatedcovers most paginators, but not everythingpaginators-1.jsoncan say. Inpaginators-1.json:ListObjectVersionsusesKeyMarkerandVersionIdMarker.more_results, such as IAM'sIsTruncated) rather than on a missing token.DescribeAlarmsreturnsMetricAlarms,CompositeAlarms, andLogAlarms.@paginatedallows one token each way, no stop field, and oneitemspath. For those paginators, this PR adds a codegen trait,software.amazon.awssdk.codegen#paginatorOverride. It carries thepaginators-1.jsonfields on the operation, so the generated paginator stays the same as on the C2J path. It sits alongside the existing Java-only codegen traits and is applied throughsmithy-build.json, so the service'smodel.jsonis not edited. Withskip: true, the trait generates no paginator, for an operation that has@paginatedbut no paginator on the C2J path. We can modify this in the future.Modifications
paginatorOverridetrait: the definition inaws-sdk-java-codegen-traits.smithyand the classPaginatorOverrideTrait, registered as aTraitService.skip: truealone, or non-emptyinputTokenandoutputTokenlists, plus optionalresultKey,moreResults, andlimitKey.AddSmithyPaginators: builds the paginator map, keyed by operation name as inpaginators-1.json.paginatorOverridewins.@paginatedis translated:inputTokenandoutputTokenbecome single-element lists,itemsbecomesresultKey, andpageSizebecomeslimitKey.@paginatedfills in members the operation leaves out, as Smithy'sPaginatedIndexdoes.SmithyIntermediateModelBuilder:deprecatedOperations, as the C2J path does.Not in this PR:
paginatorOverrideentries from a service'spaginators-1.jsonintosmithy-build.jsonbelongs with the tool that generatessmithy-build.jsonfromcustomization.config. Until then, asmithy-build.jsonwithout the overrides falls back to translating@paginated.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