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 unknown union malformed request test #2022

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ apply MalformedUnion @httpMalformedRequestTests([
{
id: "RestJsonMalformedUnionMultipleFieldsSet",
documentation: """
When the union has multiple fields set, the response should be a 400
SerializationException.""",
When the union has multiple fields set, the response should be a 400
SerializationException.""",
protocol: restJson1,
request: {
method: "POST",
uri: "/MalformedUnion",
body: """
{ "union" : { "int": 2, "string": "three" } }""",
{ "union" : { "int": 2, "string": "three" } }""",
headers: {
"content-type": "application/json"
}
Expand All @@ -37,8 +37,8 @@ apply MalformedUnion @httpMalformedRequestTests([
{
id: "RestJsonMalformedUnionKnownAndUnknownFieldsSet",
documentation: """
When the union has multiple fields set, even when only one is modeled,
the response should be a 400 SerializationException.""",
When the union has multiple fields set, even when only one is modeled,
the response should be a 400 SerializationException.""",
protocol: restJson1,
request: {
method: "POST",
Expand All @@ -59,14 +59,14 @@ apply MalformedUnion @httpMalformedRequestTests([
{
id: "RestJsonMalformedUnionNoFieldsSet",
documentation: """
When the union has no fields set, the response should be a 400
SerializationException.""",
When the union has no fields set, the response should be a 400
SerializationException.""",
protocol: restJson1,
request: {
method: "POST",
uri: "/MalformedUnion",
body: """
{ "union" : { "int": null } }""",
{ "union" : { "int": null } }""",
headers: {
"content-type": "application/json"
}
Expand All @@ -81,14 +81,14 @@ apply MalformedUnion @httpMalformedRequestTests([
{
id: "RestJsonMalformedUnionValueIsArray",
documentation: """
When the union value is actually an array, the response should be a 400
SerializationException.""",
When the union value is actually an array, the response should be a 400
SerializationException.""",
protocol: restJson1,
request: {
method: "POST",
uri: "/MalformedUnion",
body: """
{ "union" : ["int"] }""",
{ "union" : ["int"] }""",
headers: {
"content-type": "application/json"
}
Expand All @@ -99,7 +99,33 @@ apply MalformedUnion @httpMalformedRequestTests([
"x-amzn-errortype": "SerializationException"
}
}
},
}
{
id: "RestJsonMalformedUnionUnknownMember",
documentation: """
When an unknown union member is received, the response should be a 400
SerializationException."""
protocol: restJson1
request: {
method: "POST"
uri: "/MalformedUnion"
body: """
{
"union": {
"unknown": "hello"
}
}""",
headers: {
"content-type": "application/json"
}
}
response: {
code: 400
headers: {
"x-amzn-errortype": "SerializationException"
}
}
}
])

structure MalformedUnionInput {
Expand All @@ -111,4 +137,3 @@ union SimpleUnion {

string: String
}

Loading