Skip to content

Conversation

@kai-ion
Copy link
Contributor

@kai-ion kai-ion commented Jan 13, 2026

Issue #, if available:

Description of changes:
Smithy-based code generator for paginators

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

public CppWriter writeNamespaceClose(String namespace) {
write("} // namespace $L", namespace);
return this;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being a bit nitpicky but Instead of manually opening and closing namespace blocks, why don't we do something like this:

public CppWriter writeNamespaceOpen(String namespace) {
        writer.openBlock("namespace $L\n{", namespace);
        return this;
 }

and the same for writeNamespaceClose, but with writer.closeBlock. Its functionally the exact same (block functions indent/dedent which doesn't matter since we clang format anyway) , but we should try to use these functions when opening/closing blocks

@kai-ion kai-ion force-pushed the paginatorModel branch 2 times, most recently from 445995a to 927dee5 Compare January 20, 2026 16:24
…nged shapeutil logic to correctly use the legacy get/set collision rule
Fix pagination traits generator for nested tokens
andle explicit nested tokens like "EngineDefaults.Marker" correctly
abbreviation and servicename mismatch
Backward compatibility map for operations that must use "SdkResult" suffix.
S3's ListParts operation has NextPartNumberMarker as integer in C2J but string in Smithy.
@kai-ion kai-ion force-pushed the paginatorModel branch 2 times, most recently from 0fd0691 to 661e748 Compare January 23, 2026 15:24
implementation("software.amazon.smithy:smithy-aws-traits:1.51.0")
implementation("software.amazon.smithy:smithy-waiters:1.51.0")
implementation("software.amazon.smithy:smithy-rules-engine:1.51.0")
implementation("software.amazon.smithy:smithy-aws-endpoints:1.51.0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? It's not like we're going to be using smithy based endpoints rule traits right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this was from copying the pattern used in our codegen-workshop.
I will refactor the build script to use our existing pattern from smoke-test gen

parser.run();
}

public void render(CppWriter writer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we render this from scratch here? It may be ok for this particular test but should we have a more generic test file rendering logic that is not specific to Paginators?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I can abstract the common parts like header includes, test class structure, and basic compilation test setup into CompilationTestParser as well.

namespace Aws {
namespace S3 {

using ListBucketsPaginator =
Copy link
Contributor

@sbiscigl sbiscigl Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so lets talk about how we would use this Paginator then. i assume a code example would look something like

const auto s3_client = Aws::MakeShared<S3Client>("alloc-tag");
for (const auto& page: ListBucketsPaginator{s3_client, listReq}) {
  //...
}

when I look at the java documentation i see that paginator construction is a method on the client. i.e.

ListObjectsV2Iterable listRes = s3.listObjectsV2Paginator(listReq);
for (S3Object content : listRes.contents()) {
  //...
}

so my question here is why are we doing it differently than java? one of the most common complaints we get is that SDKs have different ergonmics when you switch bettween them.

so why are we creating paginators different than java and not a as a member? what is preventing us from making it a member function?

shouldnt it look something like this?:

S3Client s3_client{};
for (const auto& page: s3_client.ListBucketsPaginator{listReq}) {
  //...
}

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.

4 participants