-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Smithy generator for paginator #3690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| public CppWriter writeNamespaceClose(String namespace) { | ||
| write("} // namespace $L", namespace); | ||
| return this; | ||
| } |
There was a problem hiding this comment.
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
9bd93d6 to
3d3e5a6
Compare
3d3e5a6 to
1eb974f
Compare
…ervice name and add sdk suffix
445995a to
927dee5
Compare
… the logic to be exactly like the legacy c2j formater
…ename reshape priority
…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.
…nPlugin to templates
…mber variable tableName
0fd0691 to
661e748
Compare
| 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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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}) {
//...
}
Issue #, if available:
Description of changes:
Smithy-based code generator for paginators
Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.