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

Split sparse collection tests to new operations #2206

Merged
merged 1 commit into from
Mar 27, 2024
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 smithy-aws-protocol-tests/model/awsJson1_1/main.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ service JsonProtocol {
PutAndGetInlineDocuments,
JsonEnums,
NullOperation,
SparseNullsOperation,
GreetingWithErrors,
JsonUnions,

Expand Down
152 changes: 82 additions & 70 deletions smithy-aws-protocol-tests/model/awsJson1_1/null.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -44,52 +44,6 @@ use smithy.test#httpResponseTests
method: "POST",
uri: "/",
appliesTo: "server",
},
{
id: "AwsJson11MapsSerializeNullValues",
documentation: "Serializes null values in maps",
protocol: awsJson1_1,
body: """
{
"sparseStringMap": {
"foo": null
}
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.NullOperation",
},
params: {
"sparseStringMap": {
"foo": null
}
},
method: "POST",
uri: "/",
},
{
id: "AwsJson11ListsSerializeNull",
documentation: "Serializes null values in lists",
protocol: awsJson1_1,
body: """
{
"sparseStringList": [
null
]
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.NullOperation",
},
params: {
"sparseStringList": [
null
]
},
method: "POST",
uri: "/",
}
])
@httpResponseTests([
Expand Down Expand Up @@ -119,53 +73,111 @@ use smithy.test#httpResponseTests
string: null
},
appliesTo: "server",
},
}
])
operation NullOperation {
input: NullOperationInputOutput
output: NullOperationInputOutput
}

structure NullOperationInputOutput {
string: String
}

@httpRequestTests([
{
id: "AwsJson11MapsDeserializeNullValues",
documentation: "Deserializes null values in maps",
protocol: awsJson1_1,
code: 200,
id: "AwsJson11SparseMapsSerializeNullValues"
documentation: "Serializes null values in maps"
protocol: awsJson1_1
body: """
{
"sparseStringMap": {
"foo": null
}
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
}"""
bodyMediaType: "application/json"
headers: {
"Content-Type": "application/x-amz-json-1.1"
"X-Amz-Target": "JsonProtocol.SparseNullsOperation"
}
params: {
"sparseStringMap": {
"foo": null
}
},
}
method: "POST"
uri: "/"
},
{
id: "AwsJson11ListsDeserializeNull",
documentation: "Deserializes null values in lists",
protocol: awsJson1_1,
code: 200,
id: "AwsJson11SparseListsSerializeNull"
documentation: "Serializes null values in lists"
protocol: awsJson1_1
body: """
{
"sparseStringList": [
null
]
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
}"""
bodyMediaType: "application/json"
headers: {
"Content-Type": "application/x-amz-json-1.1"
"X-Amz-Target": "JsonProtocol.SparseNullsOperation"
}
params: {
"sparseStringList": [
null
]
},
}
method: "POST"
uri: "/"
}
])
operation NullOperation {
input: NullOperationInputOutput,
output: NullOperationInputOutput,
@httpResponseTests([
{
id: "AwsJson11SparseMapsDeserializeNullValues"
documentation: "Deserializes null values in maps"
protocol: awsJson1_1
code: 200
body: """
{
"sparseStringMap": {
"foo": null
}
}"""
bodyMediaType: "application/json"
headers: {"Content-Type": "application/x-amz-json-1.1"}
params: {
"sparseStringMap": {
"foo": null
}
}
}
{
id: "AwsJson11SparseListsDeserializeNull"
documentation: "Deserializes null values in lists"
protocol: awsJson1_1
code: 200
body: """
{
"sparseStringList": [
null
]
}"""
bodyMediaType: "application/json"
headers: {"Content-Type": "application/x-amz-json-1.1"}
params: {
"sparseStringList": [
null
]
}
}
])
operation SparseNullsOperation {
input: SparseNullsOperationInputOutput
output: SparseNullsOperationInputOutput
}

structure NullOperationInputOutput {
string: String,
sparseStringList: SparseStringList,
sparseStringMap: SparseStringMap,
structure SparseNullsOperationInputOutput {
sparseStringList: SparseStringList
sparseStringMap: SparseStringMap
}
91 changes: 52 additions & 39 deletions smithy-aws-protocol-tests/model/restJson1/json-lists.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,6 @@ apply JsonLists @httpRequestTests([
params: {
stringList: []
}
},
{
id: "RestJsonListsSerializeNull",
documentation: "Serializes null values in lists",
protocol: restJson1,
method: "PUT",
uri: "/JsonLists",
body: """
{
"sparseStringList": [
null,
"hi"
]
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/json"},
params: {
sparseStringList: [null, "hi"]
}
}
])

Expand Down Expand Up @@ -305,32 +286,12 @@ apply JsonLists @httpResponseTests([
params: {
stringList: []
}
},
{
id: "RestJsonListsSerializeNull",
documentation: "Serializes null values in sparse lists",
protocol: restJson1,
code: 200,
body: """
{
"sparseStringList": [
null,
"hi"
]
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/json"},
params: {
sparseStringList: [null, "hi"]
}
}
])

structure JsonListsInputOutput {
stringList: StringList,

sparseStringList: SparseStringList,

stringSet: StringSet,

integerList: IntegerList,
Expand Down Expand Up @@ -360,3 +321,55 @@ structure StructureListMember {
@jsonName("other")
b: String,
}

@httpRequestTests([
{
id: "RestJsonSparseListsSerializeNull"
documentation: "Serializes null values in sparse lists"
protocol: restJson1
method: "PUT"
uri: "/SparseJsonLists"
body: """
{
"sparseStringList": [
null,
"hi"
]
}"""
bodyMediaType: "application/json"
headers: {"Content-Type": "application/json"}
params: {
sparseStringList: [null, "hi"]
}
}
])
@httpResponseTests([
{
id: "RestJsonSparseListsSerializeNull"
documentation: "Serializes null values in sparse lists"
protocol: restJson1
code: 200
body: """
{
"sparseStringList": [
null,
"hi"
]
}"""
bodyMediaType: "application/json"
headers: {"Content-Type": "application/json"}
params: {
sparseStringList: [null, "hi"]
}
}
])
@idempotent
@http(uri: "/SparseJsonLists", method: "PUT")
operation SparseJsonLists {
input: SparseJsonListsInputOutput
output: SparseJsonListsInputOutput
}

structure SparseJsonListsInputOutput {
sparseStringList: SparseStringList
}
Loading
Loading