diff --git a/smithy-aws-protocol-tests/model/restJson1/documents.smithy b/smithy-aws-protocol-tests/model/restJson1/documents.smithy index 0d8b3318fb7..9ca1e68fea4 100644 --- a/smithy-aws-protocol-tests/model/restJson1/documents.smithy +++ b/smithy-aws-protocol-tests/model/restJson1/documents.smithy @@ -324,3 +324,73 @@ apply DocumentTypeAsPayload @httpResponseTests([ } } ]) + +/// This example serializes documents as the value of maps. +@idempotent +@http(uri: "/DocumentTypeAsMapValue", method: "PUT") +operation DocumentTypeAsMapValue { + input: DocumentTypeAsMapValueInputOutput, + output: DocumentTypeAsMapValueInputOutput, +} + +structure DocumentTypeAsMapValueInputOutput { + docValuedMap: DocumentValuedMap, +} + +map DocumentValuedMap { + key: String, + value: Document, +} + +apply DocumentTypeAsMapValue @httpRequestTests([ + { + id: "DocumentTypeAsMapValueInput", + documentation: "Serializes a map that uses documents as the value.", + protocol: restJson1, + method: "PUT", + uri: "/DocumentTypeAsMapValue", + body: """ + { + "docValuedMap": { + "foo": { "f": 1, "o": 2 }, + "bar": [ "b", "a", "r" ], + "baz": "BAZ" + } + }""", + bodyMediaType: "application/json", + headers: {"Content-Type": "application/json"}, + params: { + docValuedMap: { + "foo": { "f": 1, "o": 2 }, + "bar": [ "b", "a", "r" ], + "baz": "BAZ", + }, + }, + }, +]) + +apply DocumentTypeAsMapValue @httpResponseTests([ + { + id: "DocumentTypeAsMapValueOutput", + documentation: "Serializes a map that uses documents as the value.", + protocol: restJson1, + code: 200, + body: """ + { + "docValuedMap": { + "foo": { "f": 1, "o": 2 }, + "bar": [ "b", "a", "r" ], + "baz": "BAZ" + } + }""", + bodyMediaType: "application/json", + headers: {"Content-Type": "application/json"}, + params: { + docValuedMap: { + "foo": { "f": 1, "o": 2 }, + "bar": [ "b", "a", "r" ], + "baz": "BAZ", + }, + }, + }, +]) diff --git a/smithy-aws-protocol-tests/model/restJson1/main.smithy b/smithy-aws-protocol-tests/model/restJson1/main.smithy index 16c779b4f26..f0a638594c6 100644 --- a/smithy-aws-protocol-tests/model/restJson1/main.smithy +++ b/smithy-aws-protocol-tests/model/restJson1/main.smithy @@ -87,6 +87,7 @@ service RestJson { // Documents DocumentType, DocumentTypeAsPayload, + DocumentTypeAsMapValue, // Unions JsonUnions,