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 some RestJson query string protocol request tests for servers #1040

Merged

Conversation

david-perez
Copy link
Contributor

From a server perspective, params is the expected output after request
deserialization. Since queryParamsMapOfStringList is bound with
@httpQueryParams to the query string, its value must be present and
derived from the input queryParams field of the request test.

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

From a server perspective, `params` is the expected output after request
deserialization. Since `queryParamsMapOfStringList` is bound with
`@httpQueryParams` to the query string, its value must be present and
derived from the input `queryParams` field of the request test.
@david-perez david-perez requested a review from a team as a code owner January 7, 2022 17:27
@@ -139,6 +139,10 @@ apply AllQueryStringTypes @httpRequestTests([
params: {
queryFloat: "NaN",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test doesn't make sense from the server perspective anyway, since in IEEE 754 floating point numbers, NaN != NaN. As such, what should we assert we received after request deserialization, if we can't compare the deserialized value to anything? Shall I tag this test so that it only applies to the client, or should I assert something special in this case?

Copy link
Contributor

Choose a reason for hiding this comment

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

The behavior that nan isn't equal to nan is only important when you're using actual numbers for number things. Here we are asserting that the result is NaN instead of 0, +Inf, -Inf, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JordonPhillips I think what you're saying is that a protocol test involving NaN only cares that the deserialized value is a NaN and that we shouldn't compare the bits, right? That's the approach we took https://docs.rs/aws-smithy-protocol-test/latest/aws_smithy_protocol_test/trait.FloatEquals.html, let me know if something else should be asserted.

In any case, this is subtle and should be called out in the documentation, perhaps in this page? https://awslabs.github.io/smithy/1.0/spec/http-protocol-compliance-tests.html

Copy link
Contributor

@JordonPhillips JordonPhillips left a comment

Choose a reason for hiding this comment

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

omg I wrote this comment ages ago but forgot to post it

@@ -139,6 +139,10 @@ apply AllQueryStringTypes @httpRequestTests([
params: {
queryFloat: "NaN",
Copy link
Contributor

Choose a reason for hiding this comment

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

The behavior that nan isn't equal to nan is only important when you're using actual numbers for number things. Here we are asserting that the result is NaN instead of 0, +Inf, -Inf, etc.

@JordonPhillips JordonPhillips merged commit 58dad5b into smithy-lang:main Feb 21, 2022
david-perez added a commit to smithy-lang/smithy-rs that referenced this pull request Jan 4, 2023
The fixes were upstreamed in
smithy-lang/smithy#1040, which was rolled out long
ago in Smithy v1.18, 10 months ago.
david-perez added a commit to smithy-lang/smithy-rs that referenced this pull request Jan 4, 2023
The fixes were upstreamed in
smithy-lang/smithy#1040, which was rolled out long
ago in Smithy v1.18, 10 months ago.
david-perez added a commit to smithy-lang/smithy-rs that referenced this pull request Jan 4, 2023
Fixes were upstreamed in:

* smithy-lang/smithy#1040, which was rolled out in
  Smithy v1.18, 10 months ago.
* smithy-lang/smithy#1392, which was rolled out in
  Smithy v1.26.1, 9 weeks ago.
LukeMathWalker pushed a commit to smithy-lang/smithy-rs that referenced this pull request Jan 5, 2023
Fixes were upstreamed in:

* smithy-lang/smithy#1040, which was rolled out in
  Smithy v1.18, 10 months ago.
* smithy-lang/smithy#1392, which was rolled out in
  Smithy v1.26.1, 9 weeks ago.
aws-sdk-rust-ci pushed a commit to awslabs/aws-sdk-rust that referenced this pull request Jan 13, 2023
Fixes were upstreamed in:

* smithy-lang/smithy#1040, which was rolled out in
  Smithy v1.18, 10 months ago.
* smithy-lang/smithy#1392, which was rolled out in
  Smithy v1.26.1, 9 weeks ago.
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