-
Notifications
You must be signed in to change notification settings - Fork 226
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
Allow using path expressions in paginator outputs #152
Conversation
...rc/main/java/software/amazon/smithy/model/validation/validators/PaginatedTraitValidator.java
Outdated
Show resolved
Hide resolved
smithy-model/src/test/java/software/amazon/smithy/model/traits/PaginatedTraitTest.java
Show resolved
Hide resolved
...est/resources/software/amazon/smithy/model/errorfiles/validators/paginated-trait-test.errors
Outdated
Show resolved
Hide resolved
de95ab1
to
d382b43
Compare
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.
Couple of minor recommendations to fix, but LGTM otherwise
@@ -59,6 +62,7 @@ | |||
private static final Set<ShapeType> ITEM_SHAPES = SetUtils.of(ShapeType.LIST, ShapeType.MAP); | |||
private static final Set<ShapeType> PAGE_SHAPES = SetUtils.of(ShapeType.INTEGER); | |||
private static final Set<ShapeType> STRING_SET = SetUtils.of(ShapeType.STRING); | |||
private static final java.util.regex.Pattern PATH_PATTERN = Pattern.compile("\\."); |
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.
Whoops - can you remove this fully-qualified reference?
ShapeIndex index, OperationIndex opIndex, OperationShape operation, PaginatedTrait trait | ||
) { | ||
// Split up the path expression into a list of member names | ||
Optional<List<String>> memberNames = getMemberPath(opIndex, operation, trait) |
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.
Minor: this could be simplified to:
List<String> memberNames = getMemberPath(opIndex, operation, trait)
.map(value -> Arrays.asList(value.split("\\.")))
.orElse(Collections.emptyList());
Description of changes:
This allows the use of path expressions in paginator outputs. This enables
customers to have result wrapper shapes, which is a common pattern in XML
protocols.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.