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

Add protocol tests for 0/false in query params #2070

Merged

Conversation

milesziemer
Copy link
Contributor

Previously we didn't have protocol tests specifically for 0/false in query params, which allowed for situations like
smithy-lang/smithy-rs#3252 to occur.

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

@milesziemer milesziemer merged commit 44cd967 into smithy-lang:main Jan 24, 2024
10 checks passed
hpmellema pushed a commit to hpmellema/smithy that referenced this pull request Jan 25, 2024
Previously we didn't have protocol tests specifically for 0/false in query params, which allowed for situations like
smithy-lang/smithy-rs#3252 to occur.
milesziemer added a commit to milesziemer/smithy that referenced this pull request Feb 27, 2024
Intially added in smithy-lang#2070,
`RestJsonZeroAndFalseQueryValues` didn't include the correct params
that would be deserialized by a server. Specifically it omitted the
`@httpQueryParams` member `queryParamsMapOfStringList`. This member
was added back in smithy-lang#2132,
but the map keys corresponded to member names in the input struct,
rather than the literal query parameter keys. This meant that
_clients_ running this protocol test would actually have a query
string of
```
?Integer=0&Boolean=false&queryInteger=0&queryBoolean=false
```
instead of the intended
```
?Integer=0&Boolean=false
```
(`forbidQueryParams` wasn't set in the protocol test, so clients
wouldn't fail here).
_servers_ would fail this test because they'd be expecting to get
```
{
    queryInteger: 0,
    queryBoolean: false,
    queryParamsMapOfStringList: {
        queryInteger: ["0"],
        queryBoolean: ["false"]
    }
}
```
from a query string of
```
?Integer=0&Boolean=false
```
milesziemer added a commit that referenced this pull request Mar 5, 2024
Intially added in #2070,
`RestJsonZeroAndFalseQueryValues` didn't include the correct params
that would be deserialized by a server. Specifically it omitted the
`@httpQueryParams` member `queryParamsMapOfStringList`. This member
was added back in #2132,
but the map keys corresponded to member names in the input struct,
rather than the literal query parameter keys. This meant that
_clients_ running this protocol test would actually have a query
string of
```
?Integer=0&Boolean=false&queryInteger=0&queryBoolean=false
```
instead of the intended
```
?Integer=0&Boolean=false
```
(`forbidQueryParams` wasn't set in the protocol test, so clients
wouldn't fail here).
_servers_ would fail this test because they'd be expecting to get
```
{
    queryInteger: 0,
    queryBoolean: false,
    queryParamsMapOfStringList: {
        queryInteger: ["0"],
        queryBoolean: ["false"]
    }
}
```
from a query string of
```
?Integer=0&Boolean=false
```
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