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

Update AWS docs to ignore __type in unions #1945

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions docs/source-2.0/aws/protocols/aws-json.rst.template
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ to convert each shape type:
* - ``union``
- JSON object. A union is serialized identically as a ``structure``
shape, but only a single member can be set to a non-null value.
Deserializers MUST ignore an unrecognized ``__type`` member if present.


~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions docs/source-2.0/aws/protocols/aws-restjson1-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ JSON shape serialization
* - ``union``
- JSON object. A union is serialized identically as a ``structure``
shape, but only a single member can be set to a non-null value.
Deserializers MUST ignore an unrecognized ``__type`` member if present.


--------------------------
Expand Down
27 changes: 27 additions & 0 deletions smithy-aws-protocol-tests/model/awsJson1_0/unions.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -509,4 +509,31 @@ apply JsonUnions @httpResponseTests([
}
}
},
{
id: "AwsJson10DeserializeIgnoreType"
appliesTo: "client"
documentation: "Ignores an unrecognized __type property"
protocol: awsJson1_0
code: 200
body: """
{
"contents": {
"__type": "aws.protocoltests.json10#MyUnion",
"structureValue": {
"hi": "hello"
}
}
}"""
bodyMediaType: "application/json"
headers: {
"Content-Type": "application/x-amz-json-1.0"
},
params: {
contents: {
structureValue: {
hi: "hello"
}
}
}
}
])
27 changes: 27 additions & 0 deletions smithy-aws-protocol-tests/model/awsJson1_1/unions.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -440,4 +440,31 @@ apply JsonUnions @httpResponseTests([
}
}
},
{
id: "AwsJson11DeserializeIgnoreType"
appliesTo: "client"
documentation: "Ignores an unrecognized __type property"
protocol: awsJson1_1
code: 200
body: """
{
"contents": {
"__type": "aws.protocoltests.json10#MyUnion",
"structureValue": {
"hi": "hello"
}
}
}"""
bodyMediaType: "application/json"
headers: {
"Content-Type": "application/x-amz-json-1.1"
}
params: {
contents: {
structureValue: {
hi: "hello"
}
}
}
}
])
27 changes: 27 additions & 0 deletions smithy-aws-protocol-tests/model/restJson1/unions.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,33 @@ apply JsonUnions @httpResponseTests([
}
}
},
{
id: "RestJsonDeserializeIgnoreType"
appliesTo: "client"
documentation: "Ignores an unrecognized __type property"
protocol: restJson1
code: 200
body: """
{
"contents": {
"__type": "aws.protocoltests.json10#MyUnion",
"structureValue": {
"hi": "hello"
}
}
}"""
bodyMediaType: "application/json"
headers: {
"Content-Type": "application/json"
}
params: {
contents: {
structureValue: {
hi: "hello"
}
}
}
}
])


Expand Down