Skip to content

Commit

Permalink
Update opinionated protocol tests to not describe optional behavior (s…
Browse files Browse the repository at this point in the history
…mithy-lang#481)

* Update opinionated protocol tests to not describe optional behavior

Removes the protocol tests for HTTP Prefix Header deserialization,
deserializing to an empty map vs null value. Null vs empty map will be
SDK implementation specific distinction. If there was a way to model
`empty` as an expectation that would encompass both null and empty but
initialized map this test would be more portable.

Updates the empty input output serialization protocol test to expect
empty payload not empty JSON object as the serialized result. It doesn't
look like the REST-JSON protocol should be serializing empty JSON
object when no members are serialized.
  • Loading branch information
jasdel authored and Ethan Trepka committed Jul 21, 2020
1 parent f512f2d commit 2fda375
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ apply EmptyInputAndEmptyOutput @httpRequestTests([
protocol: restJson1,
method: "POST",
uri: "/EmptyInputAndEmptyOutput",
body: "{}",
body: "",
bodyMediaType: "application/json"
},
])
Expand All @@ -97,6 +97,14 @@ apply EmptyInputAndEmptyOutput @httpResponseTests([
body: "",
bodyMediaType: "application/json"
},
{
id: "RestJsonEmptyInputAndEmptyJsonObjectOutput",
documentation: "Empty output serializes no payload",
protocol: restJson1,
code: 200,
body: "{}",
bodyMediaType: "application/json"
},
])

structure EmptyInputAndEmptyOutputInput {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,6 @@ apply HttpPrefixHeaders @httpResponseTests([
}
}
},
{
id: "RestJsonHttpPrefixHeadersAreNotPresent",
documentation: "No prefix headers are serialized because the value is empty",
protocol: restJson1,
code: 200,
body: "",
headers: {
"X-Foo": "Foo"
},
params: {
foo: "Foo",
fooMap: {}
}
},
])

structure HttpPrefixHeadersInputOutput {
Expand Down

0 comments on commit 2fda375

Please sign in to comment.