-
Notifications
You must be signed in to change notification settings - Fork 205
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
Change the HTTP bindings validation to support any non-conflicting URI #2220
Conversation
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.
Only had a question about the greedy label validator.
Also for the greedy label test files, "labels" is spelled as "lables" in the file names.
] | ||
} | ||
|
||
@http(code: 200, method: "GET", uri: "/example/{greedyOne+}/bar/{greedyTwo+}") |
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.
Should greedyOne+
emit a "greedy label should be the last label" event?
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.
It doesn't as the logic is written,
if (segments.get(j).isGreedyLabel()) {
events.add(danger(shape, trait,
"At most one greedy label segment may exist in a pattern: " + pattern));
} else if (segments.get(j).isLabel()) {
events.add(danger(shape, trait,
"A greedy label must be the last label in its pattern: " + pattern));
}
It could if we convert the else if
into an if
by itself, but that will emit two events for this case, I feel like one would be better as the second is implied by the first.
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.
IMO I think it’ll help to over-emit events since these are events that could be suppressed.
The best case is to force users to explicitly suppress events per extra greedy label and per greedy label that’s not last, but here it’s “blanketed” into one event.
🤦 good catch, I will fix it in the next revision. |
Background
Changes the Smithy validation of the HTTP bindings to allow URI patterns that before were considered in conflict. In particular the following constraint was removed
And the docs changed as
This feature will allow customers the use of URI path patterns that are not ambiguous but that are not currently supported, such as:
/abc/{xyz}
and/abc/{xyz}/cde
and also those that can be ambiguous such as
/abc/bcd/{xyz}
/abc/{xyz}/cde
Servers are expected to use Specificity Routing to route request that might be ambiguous at runtime as explained in the design doc "URI Pattern Validation and Conflict Resolution".
Testing
Links
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.