Skip to content

Commit

Permalink
chore(codegen): bump smithy to 1.15.x (#3091)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Dec 10, 2021
1 parent 943dab0 commit e35f78c
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 7 deletions.
2 changes: 1 addition & 1 deletion codegen/build.gradle.kts
Expand Up @@ -31,7 +31,7 @@ allprojects {
version = "0.8.0"
}

extra["smithyVersion"] = "[1.14.0,1.15.0["
extra["smithyVersion"] = "[1.15.0,1.16.0["

// The root project doesn't produce a JAR.
tasks["jar"].enabled = false
Expand Down
Expand Up @@ -298,6 +298,7 @@ private static boolean filterProtocolTests(
if (testCase.getId().equals("QueryCustomizedError")) {
return true;
}

// TODO: Remove when server protocol tests are fixed in
// https://github.com/aws/aws-sdk-js-v3/issues/3058
// TODO: Move to filter specific to server protocol tests if added in
Expand All @@ -306,6 +307,19 @@ private static boolean filterProtocolTests(
|| testCase.getId().equals("RestJsonHttpWithHeadersButNoPayload")) {
return true;
}

// TODO: remove when there's a decision on separator to use
// https://github.com/awslabs/smithy/issues/1014
if (testCase.getId().equals("RestJsonInputAndOutputWithQuotedStringHeaders")) {
return true;
}

// TODO: remove when there's a decision on behavior for list of timestamps.
// https://github.com/awslabs/smithy/issues/1015
if (testCase.getId().equals("RestJsonInputAndOutputWithTimestampHeaders")) {
return true;
}

return false;
}

Expand Down
Expand Up @@ -2957,6 +2957,38 @@ it("RestJsonInputAndOutputWithStringHeaders:Request", async () => {
}
});

/**
* Tests requests with string list header bindings that require quoting
*/
it.skip("RestJsonInputAndOutputWithQuotedStringHeaders:Request", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
});

const command = new InputAndOutputWithHeadersCommand({
headerStringList: ["b,c", '"def"', "a"],
} as any);
try {
await client.send(command);
fail("Expected an EXPECTED_REQUEST_SERIALIZATION_ERROR to be thrown");
return;
} catch (err) {
if (!(err instanceof EXPECTED_REQUEST_SERIALIZATION_ERROR)) {
fail(err);
return;
}
const r = err.request;
expect(r.method).toBe("POST");
expect(r.path).toBe("/InputAndOutputWithHeaders");

expect(r.headers["x-stringlist"]).toBeDefined();
expect(r.headers["x-stringlist"]).toBe('"b,c",""def"",a');

expect(r.body).toBeFalsy();
}
});

/**
* Tests requests with numeric header bindings
*/
Expand Down Expand Up @@ -3062,7 +3094,7 @@ it("RestJsonInputAndOutputWithBooleanHeaders:Request", async () => {
/**
* Tests requests with timestamp header bindings
*/
it("RestJsonInputAndOutputWithTimestampHeaders:Request", async () => {
it.skip("RestJsonInputAndOutputWithTimestampHeaders:Request", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand All @@ -3085,7 +3117,7 @@ it("RestJsonInputAndOutputWithTimestampHeaders:Request", async () => {
expect(r.path).toBe("/InputAndOutputWithHeaders");

expect(r.headers["x-timestamplist"]).toBeDefined();
expect(r.headers["x-timestamplist"]).toBe("Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT");
expect(r.headers["x-timestamplist"]).toBe('"Mon, 16 Dec 2019 23:48:18 GMT", "Mon, 16 Dec 2019 23:48:18 GMT"');

expect(r.body).toBeFalsy();
}
Expand Down Expand Up @@ -3274,6 +3306,39 @@ it("RestJsonInputAndOutputWithStringHeaders:Response", async () => {
});
});

/**
* Tests responses with string list header bindings that require quoting
*/
it.skip("RestJsonInputAndOutputWithQuotedStringHeaders:Response", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new ResponseDeserializationTestHandler(true, 200, {
"x-stringlist": '"b,c",""def"",a',
}),
});

const params: any = {};
const command = new InputAndOutputWithHeadersCommand(params);

let r: any;
try {
r = await client.send(command);
} catch (err) {
fail("Expected a valid response to be returned, got err.");
return;
}
expect(r["$metadata"].httpStatusCode).toBe(200);
const paramsToValidate: any = [
{
headerStringList: ["a", "b,c", '"def"'],
},
][0];
Object.keys(paramsToValidate).forEach((param) => {
expect(r[param]).toBeDefined();
expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true);
});
});

/**
* Tests responses with numeric header bindings
*/
Expand Down Expand Up @@ -3373,11 +3438,11 @@ it("RestJsonInputAndOutputWithBooleanHeaders:Response", async () => {
/**
* Tests responses with timestamp header bindings
*/
it("RestJsonInputAndOutputWithTimestampHeaders:Response", async () => {
it.skip("RestJsonInputAndOutputWithTimestampHeaders:Response", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new ResponseDeserializationTestHandler(true, 200, {
"x-timestamplist": "Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT",
"x-timestamplist": '"Mon, 16 Dec 2019 23:48:18 GMT", "Mon, 16 Dec 2019 23:48:18 GMT"',
}),
});

Expand Down Expand Up @@ -7722,8 +7787,6 @@ it.skip("RestJsonTestPayloadStructure:Request", async () => {
});

const command = new TestPayloadStructureCommand({
testId: "t-12345",

payloadConfig: {
data: 25,
} as any,
Expand Down Expand Up @@ -7782,6 +7845,8 @@ it.skip("RestJsonHttpWithHeadersButNoPayload:Request", async () => {

expect(r.headers["content-type"]).toBeDefined();
expect(r.headers["content-type"]).toBe("application/json");
expect(r.headers["x-amz-test-id"]).toBeDefined();
expect(r.headers["x-amz-test-id"]).toBe("t-12345");

expect(r.body).toBeDefined();
const utf8Encoder = client.config.utf8Encoder;
Expand Down

0 comments on commit e35f78c

Please sign in to comment.