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

Add x-amz-target for missing AWS JSON 1.1 tests #1392

Merged
merged 2 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ apply PutAndGetInlineDocuments @httpRequestTests([
"inlineDocument": {"foo": "bar"}
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.PutAndGetInlineDocuments",
},
requireHeaders: [
"Content-Length"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ use smithy.test#httpResponseTests
id: "sends_requests_to_slash",
protocol: awsJson1_1,
documentation: "Sends requests to /",
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.EmptyOperation",
},
method: "POST",
uri: "/",
},
Expand Down Expand Up @@ -39,6 +43,7 @@ use smithy.test#httpResponseTests
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.EmptyOperation",
},
method: "POST",
uri: "/"
Expand All @@ -55,6 +60,7 @@ use smithy.test#httpResponseTests
body: "",
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.EmptyOperation",
},
method: "POST",
uri: "/",
Expand Down
5 changes: 4 additions & 1 deletion smithy-aws-protocol-tests/model/awsJson1_1/enums.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ apply JsonEnums @httpRequestTests([
"zero": "0"
}
}""",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.JsonEnums",
},
bodyMediaType: "application/json",
params: {
fooEnum1: "Foo",
Expand Down
140 changes: 112 additions & 28 deletions smithy-aws-protocol-tests/model/awsJson1_1/kitchen-sink.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ use smithy.test#httpResponseTests
protocol: awsJson1_1,
documentation: "Serializes string shapes",
body: "{\"String\":\"abc xyz\"}",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
Expand All @@ -29,7 +32,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes string shapes with jsonvalue trait",
body: "{\"JsonValue\":\"{\\\"string\\\":\\\"value\\\",\\\"number\\\":1234.5,\\\"boolTrue\\\":true,\\\"boolFalse\\\":false,\\\"array\\\":[1,2,3,4],\\\"object\\\":{\\\"key\\\":\\\"value\\\"},\\\"null\\\":null}\"}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -45,7 +51,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes integer shapes",
body: "{\"Integer\":1234}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -61,7 +70,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes long shapes",
body: "{\"Long\":999999999999}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -77,7 +89,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes float shapes",
body: "{\"Float\":1234.5}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -93,7 +108,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes double shapes",
body: "{\"Double\":1234.5}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -109,7 +127,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes blob shapes",
body: "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -125,7 +146,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes boolean shapes (true)",
body: "{\"Boolean\":true}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -141,7 +165,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes boolean shapes (false)",
body: "{\"Boolean\":false}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -157,7 +184,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes timestamp shapes",
body: "{\"Timestamp\":946845296}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -173,7 +203,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes timestamp shapes with iso8601 timestampFormat",
body: "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -189,7 +222,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes timestamp shapes with httpdate timestampFormat",
body: "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -205,7 +241,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes timestamp shapes with unixTimestamp timestampFormat",
body: "{\"UnixTimestamp\":946845296}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -221,7 +260,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes list shapes",
body: "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -241,7 +283,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes empty list shapes",
body: "{\"ListOfStrings\":[]}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -257,7 +302,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes list of map shapes",
body: "{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -283,7 +331,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes list of structure shapes",
body: "{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -309,7 +360,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes list of recursive structure shapes",
body: "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand Down Expand Up @@ -337,7 +391,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes map shapes",
body: "{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -356,7 +413,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes empty map shapes",
body: "{\"MapOfStrings\":{}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -372,7 +432,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes map of list shapes",
body: "{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -397,7 +460,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes map of structure shapes",
body: "{\"MapOfStructs\":{\"key1\":{\"Value\":\"value-1\"},\"key2\":{\"Value\":\"value-2\"}}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -420,7 +486,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes map of recursive structure shapes",
body: "{\"RecursiveMap\":{\"key1\":{\"RecursiveMap\":{\"key2\":{\"RecursiveMap\":{\"key3\":{\"Boolean\":false}}}}}}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand Down Expand Up @@ -448,7 +517,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes structure shapes",
body: "{\"SimpleStruct\":{\"Value\":\"abc\"}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -466,7 +538,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes structure members with locationName traits",
body: "{\"StructWithJsonName\":{\"Value\":\"some-value\"}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -484,7 +559,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes empty structure shapes",
body: "{\"SimpleStruct\":{}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -500,7 +578,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes structure which have no members",
body: "{\"EmptyStruct\":{}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand All @@ -516,7 +597,10 @@ use smithy.test#httpResponseTests
documentation: "Serializes recursive structure shapes",
body: "{\"String\":\"top-value\",\"Boolean\":false,\"RecursiveStruct\":{\"String\":\"nested-value\",\"Boolean\":true,\"RecursiveList\":[{\"String\":\"string-only\"},{\"RecursiveStruct\":{\"MapOfStrings\":{\"color\":\"red\",\"size\":\"large\"}}}]}}",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/x-amz-json-1.1"},
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.KitchenSinkOperation",
},
requireHeaders: [
"Content-Length"
],
Expand Down
Loading