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

Protocol test for : null values in unions #2180

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Changes from 1 commit
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
37 changes: 37 additions & 0 deletions smithy-aws-protocol-tests/model/awsJson1_0/unions.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ union MyUnion {
listValue: StringList,
mapValue: StringMap,
structureValue: GreetingStruct,
unitValue: Unit,
Copy link
Contributor

@kstich kstich Mar 13, 2024

Choose a reason for hiding this comment

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

Can the Unit target entry be separated out to its own test operation and case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed—I thought it was just an oversight that it was missing. Turns out this actually causes compilation failure in the Rust server codegen: smithy-lang/smithy-rs#2546

So we should definitely get a test with this at some point but it will probably break a few folks

}

apply JsonUnions @httpRequestTests([
Expand Down Expand Up @@ -535,5 +536,41 @@ apply JsonUnions @httpResponseTests([
}
}
}
},
{
id: "AwsJson10DeserializeAllowNulls"
appliesTo: "client"
documentation: "Allows for `: null` to be set for all unset fields"
protocol: awsJson1_0
code: 200
body: """
{
"contents": {
"stringValue": null,
"booleanValue": null,
"numberValue": null,
"blobValue": null,
"timestampValue": null,
"enumValue": null,
"intEnumValue": null,
"listValue": null,
"mapValue": null,
"structureValue": {
"hi": "hello"
},
"unitValue": null
}
}"""
bodyMediaType: "application/json"
headers: {
"Content-Type": "application/x-amz-json-1.0"
},
params: {
contents: {
structureValue: {
hi: "hello"
}
}
}
}
])