diff --git a/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy b/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy index 7e0d702ee45..a7d556ebe8b 100644 --- a/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy +++ b/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy @@ -8,6 +8,7 @@ use aws.protocols#restJson1 use aws.protocoltests.shared#FooEnumMap use aws.protocoltests.shared#GreetingStruct use aws.protocoltests.shared#SparseStringMap +use aws.protocoltests.shared#StringSet use smithy.test#httpRequestTests use smithy.test#httpResponseTests @@ -146,6 +147,80 @@ apply JsonMaps @httpRequestTests([ "x": false } } + }, + { + id: "RestJsonSerializesSparseSetMap", + documentation: "A request that contains a sparse map of sets", + protocol: restJson1, + method: "POST", + uri: "/JsonMaps", + body: """ + { + "sparseSetMap": { + "x": [], + "y": ["a", "b"] + } + }""", + bodyMediaType: "application/json", + headers: { + "Content-Type": "application/json" + }, + params: { + "sparseSetMap": { + "x": [], + "y": ["a", "b"] + } + } + }, + { + id: "RestJsonSerializesDenseSetMap", + documentation: "A request that contains a dense map of sets.", + protocol: restJson1, + method: "POST", + uri: "/JsonMaps", + body: """ + { + "denseSetMap": { + "x": [], + "y": ["a", "b"] + } + }""", + bodyMediaType: "application/json", + headers: { + "Content-Type": "application/json" + }, + params: { + "denseSetMap": { + "x": [], + "y": ["a", "b"] + } + } + }, + { + id: "RestJsonSerializesSparseSetMapAndRetainsNull", + documentation: "A request that contains a sparse map of sets.", + protocol: restJson1, + method: "POST", + uri: "/JsonMaps", + body: """ + { + "sparseSetMap": { + "x": [], + "y": ["a", "b"], + "z": null + } + }""", + bodyMediaType: "application/json", + headers: { + "Content-Type": "application/json" + }, + params: { + "sparseSetMap": { + "x": [], + "y": ["a", "b"], + "z": null + } + } } ]) @@ -274,6 +349,104 @@ apply JsonMaps @httpResponseTests([ "x": false } } + }, + { + id: "RestJsonDeserializesSparseSetMap", + documentation: "A response that contains a sparse map of sets", + protocol: restJson1, + code: 200, + body: """ + { + "sparseSetMap": { + "x": [], + "y": ["a", "b"] + } + }""", + bodyMediaType: "application/json", + headers: { + "Content-Type": "application/json" + }, + params: { + "sparseSetMap": { + "x": [], + "y": ["a", "b"] + } + } + }, + { + id: "RestJsonDeserializesDenseSetMap", + documentation: "A response that contains a dense map of sets.", + protocol: restJson1, + code: 200, + body: """ + { + "denseSetMap": { + "x": [], + "y": ["a", "b"] + } + }""", + bodyMediaType: "application/json", + headers: { + "Content-Type": "application/json" + }, + params: { + "denseSetMap": { + "x": [], + "y": ["a", "b"] + } + } + }, + { + id: "RestJsonDeserializesSparseSetMapAndRetainsNull", + documentation: "A response that contains a sparse map of sets.", + protocol: restJson1, + code: 200, + body: """ + { + "sparseSetMap": { + "x": [], + "y": ["a", "b"], + "z": null + } + }""", + bodyMediaType: "application/json", + headers: { + "Content-Type": "application/json" + }, + params: { + "sparseSetMap": { + "x": [], + "y": ["a", "b"], + "z": null + } + } + }, + { + id: "RestJsonDeserializesDenseSetMapAndSkipsNull", + documentation: """ + Clients SHOULD tolerate seeing a null value in a dense map, and they SHOULD + drop the null key-value pair.""", + protocol: restJson1, + appliesTo: "client", + code: 200, + body: """ + { + "denseSetMap": { + "x": [], + "y": ["a", "b"], + "z": null + } + }""", + bodyMediaType: "application/json", + headers: { + "Content-Type": "application/json" + }, + params: { + "denseSetMap": { + "x": [], + "y": ["a", "b"] + } + } } ]) @@ -286,6 +459,8 @@ structure JsonMapsInputOutput { sparseNumberMap: SparseNumberMap, sparseBooleanMap: SparseBooleanMap, sparseStringMap: SparseStringMap, + denseSetMap: DenseSetMap, + sparseSetMap: SparseSetMap, } map DenseStructMap { @@ -325,3 +500,14 @@ map SparseNumberMap { key: String, value: Integer } + +map DenseSetMap { + key: String, + value: StringSet +} + +@sparse +map SparseSetMap { + key: String, + value: StringSet +}