Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
2 changes: 1 addition & 1 deletion codegen/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
smithyVersion=1.58.0
smithyVersion=1.59.0
smithyGradleVersion=1.2.0
smithyPluginVersion=0.6.0
14 changes: 7 additions & 7 deletions private/aws-protocoltests-restjson-schema/src/schemas/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -2150,7 +2150,7 @@ export var SparseStructMap = map(
[_sp]: 1,
},
0,
() => GreetingStruct
() => GreetingStruct_n1
);
export var TestStringMap = 128 | 0;

Expand All @@ -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]);
Expand Down Expand Up @@ -2570,7 +2570,7 @@ export var MalformedAcceptWithBody = op(
[_ht]: ["POST", "/MalformedAcceptWithBody", 200],
},
() => Unit,
() => GreetingStruct
() => GreetingStruct_n1
);
export var MalformedAcceptWithGenericString = op(
n0,
Expand Down Expand Up @@ -2623,7 +2623,7 @@ export var MalformedContentTypeWithBody = op(
{
[_ht]: ["POST", "/MalformedContentTypeWithBody", 200],
},
() => GreetingStruct,
() => GreetingStruct_n1,
() => Unit
);
export var MalformedContentTypeWithGenericString = op(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Loading
Loading