diff --git a/codegen-server-test/build.gradle.kts b/codegen-server-test/build.gradle.kts index c72e4cde14..d81c29093d 100644 --- a/codegen-server-test/build.gradle.kts +++ b/codegen-server-test/build.gradle.kts @@ -40,6 +40,7 @@ val allCodegenTests = listOf( CodegenTest("naming_obs_structs#NamingObstacleCourseStructs", "naming_test_structs"), CodegenTest("com.amazonaws.simple#SimpleService", "simple"), CodegenTest("aws.protocoltests.restjson#RestJson", "rest_json"), + CodegenTest("aws.protocoltests.restjson#RestJsonExtras", "rest_json_extras"), CodegenTest("aws.protocoltests.restjson.validation#RestJsonValidation", "rest_json_validation"), CodegenTest("aws.protocoltests.json10#JsonRpc10", "json_rpc10"), CodegenTest("aws.protocoltests.json#JsonProtocol", "json_rpc11"), diff --git a/codegen-server-test/model/rest-json-extras.smithy b/codegen-server-test/model/rest-json-extras.smithy new file mode 120000 index 0000000000..d22b926177 --- /dev/null +++ b/codegen-server-test/model/rest-json-extras.smithy @@ -0,0 +1 @@ +../../codegen-test/model/rest-json-extras.smithy \ No newline at end of file diff --git a/codegen-test/model/rest-json-extras.smithy b/codegen-test/model/rest-json-extras.smithy index 508a47e57e..748c1e3076 100644 --- a/codegen-test/model/rest-json-extras.smithy +++ b/codegen-test/model/rest-json-extras.smithy @@ -73,16 +73,26 @@ service RestJsonExtras { @httpResponseTests([ { documentation: "Upper case error modeled lower case", - id: "ServiceLevelError", + id: "ServiceLevelErrorClient", protocol: "aws.protocols#restJson1", code: 500, body: "", headers: { "X-Amzn-Errortype": "ExtraError" }, - params: {} + params: {}, + appliesTo: "client", + }, + { + documentation: "Upper case error modeled lower case", + id: "ServiceLevelErrorServer", + protocol: "aws.protocols#restJson1", + code: 500, + body: "{}", + headers: { "X-Amzn-Errortype": "ExtraError" }, + params: {}, + appliesTo: "server", } ]) @error("server") -@error("server") structure ExtraError {} @http(uri: "/StringPayload", method: "POST") @@ -113,7 +123,8 @@ structure StringPayloadInput { uri: "/primitive-document", method: "POST", body: "{}", - params: {} + headers: { "Content-Type": "application/json" }, + params: {}, }]) @http(uri: "/primitive-document", method: "POST") operation PrimitiveIntOp { @@ -131,14 +142,14 @@ structure PrimitiveIntDocument { protocol: "aws.protocols#restJson1", code: 200, headers: { "x-field": "123" }, - params: { field: 123 } + params: { field: 123 }, }, { id: "DeserPrimitiveHeaderMissing", protocol: "aws.protocols#restJson1", code: 200, headers: { }, - params: { field: 0 } + params: { field: 0 }, } ]) @http(uri: "/primitive", method: "POST") @@ -201,7 +212,8 @@ structure MapWithEnumKeyInputOutput { method: "POST", protocol: "aws.protocols#restJson1", body: "{\"map\":{\"enumvalue\":\"something\"}}", - params: { map: { "enumvalue": "something" } } + headers: { "Content-Type": "application/json" }, + params: { map: { "enumvalue": "something" } }, }, ]) @httpResponseTests([ @@ -239,6 +251,7 @@ structure EscapedStringValuesInputOutput { method: "POST", protocol: "aws.protocols#restJson1", body: "{\"enum\":\"has\\\"quotes\",\"also\\\"has\\\"quotes\":\"test\"}", + headers: { "Content-Type": "application/json" }, params: { enum: "has\"quotes", someString: "test" }, } ]) @@ -283,6 +296,7 @@ structure NullInNonSparseOutput { code: 200, body: "{\"list\":[null,\"one\",null,\"two\",null],\"map\":{\"zero\":null,\"one\":\"1\"}}", params: { list: ["one", "two"], map: { "one": "1" } }, + appliesTo: "client", } ]) operation NullInNonSparse { @@ -296,13 +310,14 @@ operation CaseInsensitiveErrorOperation { @httpResponseTests([ { - documentation: "Upper case error modeled lower case", + documentation: "Upper case error modeled lower case. See: https://github.com/awslabs/smithy-rs/blob/6c21fb0eb377c7120a8179f4537ba99a4b50ba96/rust-runtime/inlineable/src/json_errors.rs#L51-L51", id: "UpperErrorModeledLower", protocol: "aws.protocols#restJson1", code: 500, body: "{\"Message\": \"hello\"}", headers: { "X-Amzn-Errortype": "CaseInsensitiveError" }, - params: { message: "hello" } + params: { message: "hello" }, + appliesTo: "client", } ]) @error("server") @@ -322,7 +337,8 @@ structure EmptyStructWithContentOnWireOpOutput { protocol: "aws.protocols#restJson1", code: 200, body: "{\"empty\": {\"value\":\"not actually empty\"}}", - params: { empty: {} } + params: { empty: {} }, + appliesTo: "client", } ]) operation EmptyStructWithContentOnWireOp {