Skip to content

Commit 568fe9a

Browse files
authored
chore(codegen): upgrade smithy to 1.62.0 (#7386)
1 parent 45d5730 commit 568fe9a

File tree

9 files changed

+294
-52
lines changed

9 files changed

+294
-52
lines changed

codegen/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
smithyVersion=1.61.0
1+
smithyVersion=1.62.0
22
smithyGradleVersion=1.2.0
33
smithyPluginVersion=0.6.0
44
org.gradle.jvmargs=-Xmx4096M

private/aws-protocoltests-json-10-schema/test/functional/awsjson1_0.spec.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,50 @@ it("AwsJson10FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", as
802802
fail("Expected an exception to be thrown from response");
803803
});
804804

805+
/**
806+
* Some services serialize errors using __type, and if the response includes additional shapes that belong to a different namespace there'll be a nested __type property that must not be considered when determining which error to be surfaced.
807+
*
808+
* For an example service see Amazon DynamoDB.
809+
*/
810+
it("AwsJson10FooErrorWithNestedTypeProperty:Error:GreetingWithErrors", async () => {
811+
const client = new JSONRPC10Client({
812+
...clientParams,
813+
requestHandler: new ResponseDeserializationTestHandler(
814+
false,
815+
500,
816+
{
817+
"content-type": "application/x-amz-json-1.0",
818+
},
819+
`{
820+
"__type": "aws.protocoltests.json10#FooError",
821+
"ErrorDetails": [
822+
{
823+
"__type": "com.amazon.internal#ErrorDetails",
824+
"reason": "Some reason"
825+
}
826+
]
827+
}`
828+
),
829+
});
830+
831+
const params: any = {};
832+
const command = new GreetingWithErrorsCommand(params);
833+
834+
try {
835+
await client.send(command);
836+
} catch (err) {
837+
if (err.name !== "FooError") {
838+
console.log(err);
839+
fail(`Expected a FooError to be thrown, got ${err.name} instead`);
840+
return;
841+
}
842+
const r: any = err;
843+
expect(r["$metadata"].httpStatusCode).toBe(500);
844+
return;
845+
}
846+
fail("Expected an exception to be thrown from response");
847+
});
848+
805849
/**
806850
* Custom endpoints supplied by users can have paths
807851
*/

private/aws-protocoltests-json-10/test/functional/awsjson1_0.spec.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,50 @@ it("AwsJson10FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", as
802802
fail("Expected an exception to be thrown from response");
803803
});
804804

805+
/**
806+
* Some services serialize errors using __type, and if the response includes additional shapes that belong to a different namespace there'll be a nested __type property that must not be considered when determining which error to be surfaced.
807+
*
808+
* For an example service see Amazon DynamoDB.
809+
*/
810+
it("AwsJson10FooErrorWithNestedTypeProperty:Error:GreetingWithErrors", async () => {
811+
const client = new JSONRPC10Client({
812+
...clientParams,
813+
requestHandler: new ResponseDeserializationTestHandler(
814+
false,
815+
500,
816+
{
817+
"content-type": "application/x-amz-json-1.0",
818+
},
819+
`{
820+
"__type": "aws.protocoltests.json10#FooError",
821+
"ErrorDetails": [
822+
{
823+
"__type": "com.amazon.internal#ErrorDetails",
824+
"reason": "Some reason"
825+
}
826+
]
827+
}`
828+
),
829+
});
830+
831+
const params: any = {};
832+
const command = new GreetingWithErrorsCommand(params);
833+
834+
try {
835+
await client.send(command);
836+
} catch (err) {
837+
if (err.name !== "FooError") {
838+
console.log(err);
839+
fail(`Expected a FooError to be thrown, got ${err.name} instead`);
840+
return;
841+
}
842+
const r: any = err;
843+
expect(r["$metadata"].httpStatusCode).toBe(500);
844+
return;
845+
}
846+
fail("Expected an exception to be thrown from response");
847+
});
848+
805849
/**
806850
* Custom endpoints supplied by users can have paths
807851
*/

private/aws-protocoltests-json-schema/test/functional/awsjson1_1.spec.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,50 @@ it("AwsJson11FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", as
10701070
fail("Expected an exception to be thrown from response");
10711071
});
10721072

1073+
/**
1074+
* Some services serialize errors using __type, and if the response includes additional shapes that belong to a different namespace there'll be a nested __type property that must not be considered when determining which error to be surfaced.
1075+
*
1076+
* For an example service see Amazon DynamoDB.
1077+
*/
1078+
it("AwsJson11FooErrorWithNestedTypeProperty:Error:GreetingWithErrors", async () => {
1079+
const client = new JsonProtocolClient({
1080+
...clientParams,
1081+
requestHandler: new ResponseDeserializationTestHandler(
1082+
false,
1083+
500,
1084+
{
1085+
"content-type": "application/x-amz-json-1.1",
1086+
},
1087+
`{
1088+
"__type": "aws.protocoltests.restjson#FooError",
1089+
"ErrorDetails": [
1090+
{
1091+
"__type": "com.amazon.internal#ErrorDetails",
1092+
"reason": "Some reason"
1093+
}
1094+
]
1095+
}`
1096+
),
1097+
});
1098+
1099+
const params: any = {};
1100+
const command = new GreetingWithErrorsCommand(params);
1101+
1102+
try {
1103+
await client.send(command);
1104+
} catch (err) {
1105+
if (err.name !== "FooError") {
1106+
console.log(err);
1107+
fail(`Expected a FooError to be thrown, got ${err.name} instead`);
1108+
return;
1109+
}
1110+
const r: any = err;
1111+
expect(r["$metadata"].httpStatusCode).toBe(500);
1112+
return;
1113+
}
1114+
fail("Expected an exception to be thrown from response");
1115+
});
1116+
10731117
/**
10741118
* Custom endpoints supplied by users can have paths
10751119
*/

private/aws-protocoltests-json/test/functional/awsjson1_1.spec.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,50 @@ it("AwsJson11FooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", as
10701070
fail("Expected an exception to be thrown from response");
10711071
});
10721072

1073+
/**
1074+
* Some services serialize errors using __type, and if the response includes additional shapes that belong to a different namespace there'll be a nested __type property that must not be considered when determining which error to be surfaced.
1075+
*
1076+
* For an example service see Amazon DynamoDB.
1077+
*/
1078+
it("AwsJson11FooErrorWithNestedTypeProperty:Error:GreetingWithErrors", async () => {
1079+
const client = new JsonProtocolClient({
1080+
...clientParams,
1081+
requestHandler: new ResponseDeserializationTestHandler(
1082+
false,
1083+
500,
1084+
{
1085+
"content-type": "application/x-amz-json-1.1",
1086+
},
1087+
`{
1088+
"__type": "aws.protocoltests.restjson#FooError",
1089+
"ErrorDetails": [
1090+
{
1091+
"__type": "com.amazon.internal#ErrorDetails",
1092+
"reason": "Some reason"
1093+
}
1094+
]
1095+
}`
1096+
),
1097+
});
1098+
1099+
const params: any = {};
1100+
const command = new GreetingWithErrorsCommand(params);
1101+
1102+
try {
1103+
await client.send(command);
1104+
} catch (err) {
1105+
if (err.name !== "FooError") {
1106+
console.log(err);
1107+
fail(`Expected a FooError to be thrown, got ${err.name} instead`);
1108+
return;
1109+
}
1110+
const r: any = err;
1111+
expect(r["$metadata"].httpStatusCode).toBe(500);
1112+
return;
1113+
}
1114+
fail("Expected an exception to be thrown from response");
1115+
});
1116+
10731117
/**
10741118
* Custom endpoints supplied by users can have paths
10751119
*/

private/aws-protocoltests-restjson-schema/test/functional/restjson1.spec.ts

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,6 +2240,50 @@ it("RestJsonFooErrorWithDunderTypeUriAndNamespace:Error:GreetingWithErrors", asy
22402240
fail("Expected an exception to be thrown from response");
22412241
});
22422242

2243+
/**
2244+
* Some services serialize errors using __type, and if the response includes additional shapes that belong to a different namespace there'll be a nested __type property that must not be considered when determining which error to be surfaced.
2245+
*
2246+
* For an example service see Amazon DynamoDB.
2247+
*/
2248+
it("RestJsonFooErrorWithNestedTypeProperty:Error:GreetingWithErrors", async () => {
2249+
const client = new RestJsonProtocolClient({
2250+
...clientParams,
2251+
requestHandler: new ResponseDeserializationTestHandler(
2252+
false,
2253+
500,
2254+
{
2255+
"content-type": "application/json",
2256+
},
2257+
`{
2258+
"__type": "aws.protocoltests.restjson#FooError",
2259+
"ErrorDetails": [
2260+
{
2261+
"__type": "com.amazon.internal#ErrorDetails",
2262+
"reason": "Some reason"
2263+
}
2264+
]
2265+
}`
2266+
),
2267+
});
2268+
2269+
const params: any = {};
2270+
const command = new GreetingWithErrorsCommand(params);
2271+
2272+
try {
2273+
await client.send(command);
2274+
} catch (err) {
2275+
if (err.name !== "FooError") {
2276+
console.log(err);
2277+
fail(`Expected a FooError to be thrown, got ${err.name} instead`);
2278+
return;
2279+
}
2280+
const r: any = err;
2281+
expect(r["$metadata"].httpStatusCode).toBe(500);
2282+
return;
2283+
}
2284+
fail("Expected an exception to be thrown from response");
2285+
});
2286+
22432287
/**
22442288
* Custom endpoints supplied by users can have paths
22452289
*/
@@ -3577,7 +3621,7 @@ it("RestJsonIgnoreQueryParamsInResponse:Response", async () => {
35773621
{
35783622
"content-type": "application/json",
35793623
},
3580-
`{}`
3624+
`{"baz":"bam"}`
35813625
),
35823626
});
35833627

@@ -3592,30 +3636,18 @@ it("RestJsonIgnoreQueryParamsInResponse:Response", async () => {
35923636
return;
35933637
}
35943638
expect(r["$metadata"].httpStatusCode).toBe(200);
3595-
});
3596-
3597-
/**
3598-
* This test is similar to RestJsonIgnoreQueryParamsInResponse,
3599-
* but it ensures that clients gracefully handle responses from
3600-
* the server that do not serialize an empty JSON object.
3601-
*/
3602-
it("RestJsonIgnoreQueryParamsInResponseNoPayload:Response", async () => {
3603-
const client = new RestJsonProtocolClient({
3604-
...clientParams,
3605-
requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``),
3639+
const paramsToValidate: any = [
3640+
{
3641+
baz: "bam",
3642+
},
3643+
][0];
3644+
Object.keys(paramsToValidate).forEach((param) => {
3645+
expect(
3646+
r[param],
3647+
`The output field ${param} should have been defined in ${JSON.stringify(r, null, 2)}`
3648+
).toBeDefined();
3649+
expect(equivalentContents(paramsToValidate[param], r[param])).toBe(true);
36063650
});
3607-
3608-
const params: any = {};
3609-
const command = new IgnoreQueryParamsInResponseCommand(params);
3610-
3611-
let r: any;
3612-
try {
3613-
r = await client.send(command);
3614-
} catch (err) {
3615-
fail("Expected a valid response to be returned, got " + err);
3616-
return;
3617-
}
3618-
expect(r["$metadata"].httpStatusCode).toBe(200);
36193651
});
36203652

36213653
/**

0 commit comments

Comments
 (0)