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

Adjust query string parameter tests for servers #857

Merged

Conversation

adamthom-amzn
Copy link
Contributor

Description of changes:
On the server side, @httpQueryParams holds all of the query parameter values
in the request, so if any of the query parameters has a list value, then
@httpQueryParams must target a map with a list value, otherwise a 400 will be
thrown during deserialization, instead of discarding excess query param values.

An alternative solution could be to adjust SSDK behavior where @httpQueryParams would only receive query parameter values that were not otherwise explicitly bound to a structure member.

Prior art in this area is for the service to truncate to the last specified query parameter value when binding all query parameters to a map of strings, and since that's not at all a desirable behavior, and this doesn't change what gets put on the wire, we have considerable leeway to choose the behavior we want.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

On the server side, @httpQueryParams holds all of the query parameter values
in the request, so if any of the query parameters has a list value, then
@httpQueryParams must target a map with a list value, otherwise a 400 will be
thrown during deserialization, instead of discarding excess query param values.
Comment on lines +108 to +110
queryParamsMapOfStringList: {
"QueryParamsStringKeyA": ["Foo"],
"QueryParamsStringKeyB": ["Bar"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we should have this test, but why do we need to get rid of the old one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If @httpQueryParams is on a member, it has to be on a map of lists if any other @httpQuery member can have multiple values. So this isn't really about removing or adding tests, it's about making this test compatible with servers.

@JordonPhillips JordonPhillips merged commit 49d8e3e into smithy-lang:main Jul 14, 2021
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.

2 participants