From 346f1575f1f33eea27bc3101a1c0ddcd4802febf Mon Sep 17 00:00:00 2001 From: Ken Gilmer Date: Thu, 7 Jan 2021 18:05:16 -0800 Subject: [PATCH 1/2] Add test for map of sets to restJson protocol test. --- .../model/restJson1/json-maps.smithy | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy b/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy index 7e0d702ee45..5398c589ca9 100644 --- a/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy +++ b/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy @@ -286,6 +286,8 @@ structure JsonMapsInputOutput { sparseNumberMap: SparseNumberMap, sparseBooleanMap: SparseBooleanMap, sparseStringMap: SparseStringMap, + denseSetMap: DenseSetMap, + sparseSetMap: SparseSetMap, } map DenseStructMap { @@ -325,3 +327,14 @@ map SparseNumberMap { key: String, value: Integer } + +map DenseSetMap { + key: String, + value: aws.protocoltests.shared#StringSet +} + +@sparse +map SparseSetMap { + key: String, + value: aws.protocoltests.shared#StringSet +} \ No newline at end of file From ad6d0a89a558f8ba8ebe2cd5aecc319831a5a047 Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Fri, 11 Jun 2021 15:24:04 -0700 Subject: [PATCH 2/2] Add JSON protocol tests for a map of sets --- .../model/restJson1/json-maps.smithy | 179 +++++++++++++++++- 1 file changed, 176 insertions(+), 3 deletions(-) diff --git a/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy b/smithy-aws-protocol-tests/model/restJson1/json-maps.smithy index 5398c589ca9..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"] + } + } } ]) @@ -330,11 +503,11 @@ map SparseNumberMap { map DenseSetMap { key: String, - value: aws.protocoltests.shared#StringSet + value: StringSet } @sparse map SparseSetMap { key: String, - value: aws.protocoltests.shared#StringSet -} \ No newline at end of file + value: StringSet +}