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

Fix the RestJsonZeroAndFalseQueryValues protocol test for servers #2132

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

jdisanti
Copy link
Contributor

@jdisanti jdisanti commented Feb 8, 2024

The new RestJsonZeroAndFalseQueryValues test that was released in Smithy 1.44 has incorrect parameters for servers. Other protocol tests that use @httpQueryParams explicitly set a params value for the member(s) with that trait, but this new test is not. This causes the smithy-rs server protocol tests to fail upon upgrading despite code generating the correct behavior.

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

@kstich kstich merged commit 779ed44 into smithy-lang:main Feb 8, 2024
10 checks passed
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