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

Fix protocol tests for sparse traits #631

Merged
merged 1 commit into from
Nov 12, 2020
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
35 changes: 20 additions & 15 deletions smithy-aws-protocol-tests/model/awsJson1_1/null.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ $version: "1.0"
namespace aws.protocoltests.json

use aws.protocols#awsJson1_1
use aws.protocoltests.shared#StringList
use aws.protocoltests.shared#SparseStringList
use aws.protocoltests.shared#SparseStringMap
use aws.protocoltests.shared#StringMap
use smithy.test#httpRequestTests
use smithy.test#httpResponseTests
Expand All @@ -28,16 +29,16 @@ use smithy.test#httpResponseTests
protocol: awsJson1_1,
body: """
{
"stringMap": {
"sparseStringMap": {
"foo": null
}
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
params: {
stringMap: {
"foo": null
}
"sparseStringMap": {
"foo": null
}
},
method: "POST",
uri: "/",
Expand All @@ -48,14 +49,16 @@ use smithy.test#httpResponseTests
protocol: awsJson1_1,
body: """
{
"stringList": [
"sparseStringList": [
null
]
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
params: {
stringList: [null]
"sparseStringList": [
null
]
},
method: "POST",
uri: "/",
Expand All @@ -82,16 +85,16 @@ use smithy.test#httpResponseTests
code: 200,
body: """
{
"stringMap": {
"sparseStringMap": {
"foo": null
}
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
params: {
stringMap: {
"foo": null
}
"sparseStringMap": {
"foo": null
}
},
},
{
Expand All @@ -101,14 +104,16 @@ use smithy.test#httpResponseTests
code: 200,
body: """
{
"stringList": [
"sparseStringList": [
null
]
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
params: {
stringList: [null]
"sparseStringList": [
null
]
},
}
])
Expand All @@ -119,6 +124,6 @@ operation NullOperation {

structure NullOperationInputOutput {
string: String,
stringList: StringList,
stringMap: StringMap,
sparseStringList: SparseStringList,
sparseStringMap: SparseStringMap,
}
19 changes: 12 additions & 7 deletions smithy-aws-protocol-tests/model/restJson1/json-lists.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use aws.protocoltests.shared#GreetingList
use aws.protocoltests.shared#IntegerList
use aws.protocoltests.shared#NestedStringList
use aws.protocoltests.shared#StringList
use aws.protocoltests.shared#SparseStringList
use aws.protocoltests.shared#StringSet
use aws.protocoltests.shared#TimestampList
use smithy.test#httpRequestTests
Expand Down Expand Up @@ -158,14 +159,15 @@ apply JsonLists @httpRequestTests([
uri: "/JsonLists",
body: """
{
"stringList": [
null
"sparseStringList": [
null,
"hi"
]
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/json"},
params: {
stringList: [null]
sparseStringList: [null, "hi"]
}
}
])
Expand Down Expand Up @@ -289,26 +291,29 @@ apply JsonLists @httpResponseTests([
},
{
id: "RestJsonListsSerializeNull",
documentation: "Serializes null values in lists",
documentation: "Serializes null values in sparse lists",
protocol: restJson1,
code: 200,
body: """
{
"stringList": [
null
"sparseStringList": [
null,
"hi"
]
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/json"},
params: {
stringList: [null]
sparseStringList: [null, "hi"]
}
}
])

structure JsonListsInputOutput {
stringList: StringList,

sparseStringList: SparseStringList,

stringSet: StringSet,

integerList: IntegerList,
Expand Down
Loading