Conversation
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.
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.
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
There was a problem hiding this comment.
Smithy actually needs all the above dependencies, in the current set up we are not accepting any unknown traits
20097ca to
7433789
Compare
a426d02 to
03ae46d
Compare
239688c to
fe3fc77
Compare
ac53a13 to
3616995
Compare
| size_t pageCount = 0; | ||
| auto paginator = dynamoClient.ScanPaginator(request); | ||
|
|
||
| for (auto pageIter = paginator.begin(); pageIter != paginator.end(); ++pageIter) { |
There was a problem hiding this comment.
nit: validate that
for (cont auto& pageIter: paginator) {
...
}
works as that is the most idomatic way people will likely use this
| } | ||
|
|
||
| String token = outToken.get(); | ||
| List<TokenResolver> resolvers = List.of( |
There was a problem hiding this comment.
make this static/immtuable list, we dont want to re-create this everytime we call the function, this list will never change at runtime
There was a problem hiding this comment.
Okay I made it immutable with final and initialized in the constructor, this way we only re-create this once per service generation and not once per trait generation
private final List<TokenResolver> resolvers; initialized in the constructor
| for (TokenResolver resolver : resolvers) { | ||
| if (resolver.canResolve(token, op)) { | ||
| resolver.writeLogic(writer, token, op); | ||
| return; |
There was a problem hiding this comment.
premature returning is anti patter lets make this a a stream
resolvers.stream()
.filter(resolver -> resolver.canResolve(token, op))
.findFirst()
.ifPresentOrElse(resolver -> resolver.writeLogic(writer, token, op),
() -> {
// Fallback
if (ShapeUtil.hasTopLevelMember(context.getModel(), op, "IsTruncated")) {
writer.write(" return result.GetIsTruncated();");
} else {
writer.write(" return false;");
}
});
potentially refactoring the fallback method to a private function
There was a problem hiding this comment.
Made it into a stream instead of early return.
Not sure if we need to refactor it to a private function though, its only used in this specific case.
|
approved, try to address the left over comments as you fix the build |
6771542 to
74555ec
Compare
… clients, service-specific patches, and integration tests for S3, EC2, and DynamoDB
87f6eb3 to
2b1b71f
Compare
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.