Skip to content
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

Merged
merged 6 commits into from
Sep 9, 2019

Conversation

JordonPhillips
Copy link
Contributor

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.

Copy link
Member

@mtdowling mtdowling left a 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("\\.");
Copy link
Member

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)
Copy link
Member

@mtdowling mtdowling Sep 4, 2019

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());

@JordonPhillips JordonPhillips merged commit 1a28e83 into smithy-lang:master Sep 9, 2019
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.

3 participants