diff --git a/codegen/gradle.properties b/codegen/gradle.properties index 60a155e9dd04..8975397d1545 100644 --- a/codegen/gradle.properties +++ b/codegen/gradle.properties @@ -1,2 +1,2 @@ -smithyVersion=1.49.0 +smithyVersion=1.50.0 smithyGradleVersion=0.6.0 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 665fb299f7de..f0e95365937b 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 @@ -336,6 +336,11 @@ private static boolean filterProtocolTests( return true; } + // ToDo: https://github.com/aws/aws-sdk-js-v3/issues/6246 + if (testCase.getId().equals("RestJsonMustSupportParametersInContentType")) { + return true; + } + return false; } @@ -393,6 +398,12 @@ private static boolean filterMalformedRequestTests( return true; } + // ToDo: https://github.com/aws/aws-sdk-js-v3/issues/6246 + if (testCase.getId().equals("RestJsonStringPayloadNoContentType") + || testCase.getId().equals("RestJsonWithBodyExpectsApplicationJsonContentTypeNoHeaders")) { + return true; + } + return false; } } diff --git a/private/aws-protocoltests-ec2/README.md b/private/aws-protocoltests-ec2/README.md index 9fcc1697b0df..1ca244836dbb 100644 --- a/private/aws-protocoltests-ec2/README.md +++ b/private/aws-protocoltests-ec2/README.md @@ -402,6 +402,14 @@ XmlTimestamps [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/XmlTimestampsCommandOutput/) + +
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -538,6 +546,14 @@ SparseNullsOperation [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/SparseNullsOperationCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -946,6 +962,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -1538,6 +1562,22 @@ OmitsSerializingEmptyLists [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/OmitsSerializingEmptyListsCommandOutput/) +
+
+ +OperationWithDefaults + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/OperationWithDefaultsCommandOutput/) + +
+
+ +OperationWithNestedStructure + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/OperationWithNestedStructureCommandOutput/) +
@@ -1666,6 +1706,14 @@ TestBodyStructure [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/TestBodyStructureCommandOutput/) +
+
+ +TestNoInputNoPayload + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/TestNoInputNoPayloadCommandOutput/) +
@@ -1834,6 +1882,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ec2-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ec2-protocol/Interface/ContentTypeParametersCommandOutput/) +
diff --git a/private/aws-protocoltests-ec2/test/functional/ec2query.spec.ts b/private/aws-protocoltests-ec2/test/functional/ec2query.spec.ts index 6517aad37a32..8d67af769ddf 100644 --- a/private/aws-protocoltests-ec2/test/functional/ec2query.spec.ts +++ b/private/aws-protocoltests-ec2/test/functional/ec2query.spec.ts @@ -188,7 +188,7 @@ it("Ec2QueryDateTimeWithNegativeOffset:Response", async () => { }, ` 2019-12-16T22:48:18-01:00 - requestid + requestid ` ), @@ -230,7 +230,7 @@ it("Ec2QueryDateTimeWithPositiveOffset:Response", async () => { }, ` 2019-12-17T00:48:18+01:00 - requestid + requestid ` ), @@ -305,7 +305,7 @@ it("Ec2QueryEmptyInputAndEmptyOutput:Response", async () => { "content-type": "text/xml;charset=UTF-8", }, ` - requestid + requestid ` ), @@ -419,7 +419,7 @@ it("Ec2QueryDateTimeWithFractionalSeconds:Response", async () => { }, ` 2000-01-02T20:34:56.123Z - requestid + requestid ` ), @@ -461,7 +461,7 @@ it("Ec2GreetingWithErrors:Response", async () => { }, ` Hello - requestid + requestid ` ), @@ -508,7 +508,7 @@ it("Ec2InvalidGreetingError:Error:GreetingWithErrors", async () => { Hi - foo-id + foo-id ` ), @@ -561,7 +561,7 @@ it("Ec2ComplexError:Error:GreetingWithErrors", async () => { - foo-id + foo-id ` ), @@ -644,7 +644,7 @@ it("Ec2IgnoresWrappingXmlName:Response", async () => { }, ` bar - requestid + requestid ` ), @@ -764,7 +764,7 @@ it("Ec2QueryNoInputAndOutput:Response", async () => { "content-type": "text/xml;charset=UTF-8", }, ` - requestid + requestid ` ), @@ -1180,7 +1180,7 @@ it("Ec2RecursiveShapes:Response", async () => { - requestid + requestid ` ), @@ -1736,7 +1736,7 @@ it("Ec2SimpleScalarProperties:Response", async () => { 4 5.5 6.5 - requestid + requestid ` ), @@ -1928,7 +1928,7 @@ it("Ec2XmlBlobs:Response", async () => { }, ` dmFsdWU= - requestid + requestid ` ), @@ -1970,7 +1970,7 @@ it("Ec2XmlEmptyBlobs:Response", async () => { }, ` - requestid + requestid ` ), @@ -2012,7 +2012,7 @@ it("Ec2XmlEmptySelfClosedBlobs:Response", async () => { }, ` - requestid + requestid ` ), @@ -2118,7 +2118,7 @@ it("Ec2XmlEnums:Response", async () => { 0 - requestid + requestid ` ), @@ -2194,7 +2194,7 @@ it("Ec2XmlIntEnums:Response", async () => { 2 - requestid + requestid ` ), @@ -2317,7 +2317,7 @@ it("Ec2XmlLists:Response", async () => { 4 - requestid + requestid ` ), @@ -2415,7 +2415,7 @@ it("Ec2XmlNamespaces:Response", async () => { Baz - requestid + requestid ` ), @@ -2461,7 +2461,7 @@ it("Ec2XmlTimestamps:Response", async () => { }, ` 2014-04-29T18:30:38Z - requestid + requestid ` ), @@ -2503,7 +2503,7 @@ it("Ec2XmlTimestampsWithDateTimeFormat:Response", async () => { }, ` 2014-04-29T18:30:38Z - requestid + requestid ` ), @@ -2545,7 +2545,7 @@ it("Ec2XmlTimestampsWithDateTimeOnTargetFormat:Response", async () => { }, ` 2014-04-29T18:30:38Z - requestid + requestid ` ), @@ -2587,7 +2587,7 @@ it("Ec2XmlTimestampsWithEpochSecondsFormat:Response", async () => { }, ` 1398796238 - requestid + requestid ` ), @@ -2629,7 +2629,7 @@ it("Ec2XmlTimestampsWithEpochSecondsOnTargetFormat:Response", async () => { }, ` 1398796238 - requestid + requestid ` ), @@ -2671,7 +2671,7 @@ it("Ec2XmlTimestampsWithHttpDateFormat:Response", async () => { }, ` Tue, 29 Apr 2014 18:30:38 GMT - requestid + requestid ` ), @@ -2713,7 +2713,7 @@ it("Ec2XmlTimestampsWithHttpDateOnTargetFormat:Response", async () => { }, ` Tue, 29 Apr 2014 18:30:38 GMT - requestid + requestid ` ), diff --git a/private/aws-protocoltests-json-10/README.md b/private/aws-protocoltests-json-10/README.md index 559a2cfdf146..c8be3b033ca9 100644 --- a/private/aws-protocoltests-json-10/README.md +++ b/private/aws-protocoltests-json-10/README.md @@ -400,6 +400,14 @@ XmlTimestamps [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/XmlTimestampsCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ContentTypeParametersCommandOutput/) +
@@ -536,6 +544,14 @@ SparseNullsOperation [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/SparseNullsOperationCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ContentTypeParametersCommandOutput/) +
@@ -944,6 +960,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ContentTypeParametersCommandOutput/) +
@@ -1536,6 +1560,22 @@ OmitsSerializingEmptyLists [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/OmitsSerializingEmptyListsCommandOutput/) +
+
+ +OperationWithDefaults + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/OperationWithDefaultsCommandOutput/) + +
+
+ +OperationWithNestedStructure + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/OperationWithNestedStructureCommandOutput/) +
@@ -1664,6 +1704,14 @@ TestBodyStructure [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/TestBodyStructureCommandOutput/) +
+
+ +TestNoInputNoPayload + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/TestNoInputNoPayloadCommandOutput/) +
@@ -1832,6 +1880,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-rpc-10/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-rpc-10/Interface/ContentTypeParametersCommandOutput/) +
diff --git a/private/aws-protocoltests-json-10/src/JSONRPC10.ts b/private/aws-protocoltests-json-10/src/JSONRPC10.ts index 822a872a9366..400e0d2e07ad 100644 --- a/private/aws-protocoltests-json-10/src/JSONRPC10.ts +++ b/private/aws-protocoltests-json-10/src/JSONRPC10.ts @@ -2,6 +2,11 @@ import { createAggregatedClient } from "@smithy/smithy-client"; import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types"; +import { + ContentTypeParametersCommand, + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "./commands/ContentTypeParametersCommand"; import { EmptyInputAndEmptyOutputCommand, EmptyInputAndEmptyOutputCommandInput, @@ -66,6 +71,7 @@ import { import { JSONRPC10Client, JSONRPC10ClientConfig } from "./JSONRPC10Client"; const commands = { + ContentTypeParametersCommand, EmptyInputAndEmptyOutputCommand, EndpointOperationCommand, EndpointWithHostLabelOperationCommand, @@ -82,6 +88,24 @@ const commands = { }; export interface JSONRPC10 { + /** + * @see {@link ContentTypeParametersCommand} + */ + contentTypeParameters(): Promise; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + cb: (err: any, data?: ContentTypeParametersCommandOutput) => void + ): void; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ContentTypeParametersCommandOutput) => void + ): void; + /** * @see {@link EmptyInputAndEmptyOutputCommand} */ diff --git a/private/aws-protocoltests-json-10/src/JSONRPC10Client.ts b/private/aws-protocoltests-json-10/src/JSONRPC10Client.ts index 2372f4597a97..8a6e671f9cfe 100644 --- a/private/aws-protocoltests-json-10/src/JSONRPC10Client.ts +++ b/private/aws-protocoltests-json-10/src/JSONRPC10Client.ts @@ -60,6 +60,10 @@ import { HttpAuthSchemeResolvedConfig, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider"; +import { + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "./commands/ContentTypeParametersCommand"; import { EmptyInputAndEmptyOutputCommandInput, EmptyInputAndEmptyOutputCommandOutput, @@ -106,6 +110,7 @@ export { __Client }; * @public */ export type ServiceInputTypes = + | ContentTypeParametersCommandInput | EmptyInputAndEmptyOutputCommandInput | EndpointOperationCommandInput | EndpointWithHostLabelOperationCommandInput @@ -124,6 +129,7 @@ export type ServiceInputTypes = * @public */ export type ServiceOutputTypes = + | ContentTypeParametersCommandOutput | EmptyInputAndEmptyOutputCommandOutput | EndpointOperationCommandOutput | EndpointWithHostLabelOperationCommandOutput diff --git a/private/aws-protocoltests-json-10/src/commands/ContentTypeParametersCommand.ts b/private/aws-protocoltests-json-10/src/commands/ContentTypeParametersCommand.ts new file mode 100644 index 000000000000..74f10b8c8b0b --- /dev/null +++ b/private/aws-protocoltests-json-10/src/commands/ContentTypeParametersCommand.ts @@ -0,0 +1,73 @@ +// smithy-typescript generated code +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { JSONRPC10ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JSONRPC10Client"; +import { ContentTypeParametersInput, ContentTypeParametersOutput } from "../models/models_0"; +import { de_ContentTypeParametersCommand, se_ContentTypeParametersCommand } from "../protocols/Aws_json1_0"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link ContentTypeParametersCommand}. + */ +export interface ContentTypeParametersCommandInput extends ContentTypeParametersInput {} +/** + * @public + * + * The output of {@link ContentTypeParametersCommand}. + */ +export interface ContentTypeParametersCommandOutput extends ContentTypeParametersOutput, __MetadataBearer {} + +/** + * The example tests how servers must support requests + * containing a `Content-Type` header with parameters. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JSONRPC10Client, ContentTypeParametersCommand } from "@aws-sdk/aws-protocoltests-json-10"; // ES Modules import + * // const { JSONRPC10Client, ContentTypeParametersCommand } = require("@aws-sdk/aws-protocoltests-json-10"); // CommonJS import + * const client = new JSONRPC10Client(config); + * const input = { // ContentTypeParametersInput + * value: Number("int"), + * }; + * const command = new ContentTypeParametersCommand(input); + * const response = await client.send(command); + * // {}; + * + * ``` + * + * @param ContentTypeParametersCommandInput - {@link ContentTypeParametersCommandInput} + * @returns {@link ContentTypeParametersCommandOutput} + * @see {@link ContentTypeParametersCommandInput} for command's `input` shape. + * @see {@link ContentTypeParametersCommandOutput} for command's `response` shape. + * @see {@link JSONRPC10ClientResolvedConfig | config} for JSONRPC10Client's `config` shape. + * + * @throws {@link JSONRPC10ServiceException} + *

Base exception class for all service exceptions from JSONRPC10 service.

+ * + * @public + */ +export class ContentTypeParametersCommand extends $Command + .classBuilder< + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, + JSONRPC10ClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .m(function (this: any, Command: any, cs: any, config: JSONRPC10ClientResolvedConfig, o: any) { + return [getSerdePlugin(config, this.serialize, this.deserialize)]; + }) + .s("JsonRpc10", "ContentTypeParameters", {}) + .n("JSONRPC10Client", "ContentTypeParametersCommand") + .f(void 0, void 0) + .ser(se_ContentTypeParametersCommand) + .de(de_ContentTypeParametersCommand) + .build() {} diff --git a/private/aws-protocoltests-json-10/src/commands/index.ts b/private/aws-protocoltests-json-10/src/commands/index.ts index 57c2e9f6e872..298a00e5d9fe 100644 --- a/private/aws-protocoltests-json-10/src/commands/index.ts +++ b/private/aws-protocoltests-json-10/src/commands/index.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +export * from "./ContentTypeParametersCommand"; export * from "./EmptyInputAndEmptyOutputCommand"; export * from "./EndpointOperationCommand"; export * from "./EndpointWithHostLabelOperationCommand"; diff --git a/private/aws-protocoltests-json-10/src/models/models_0.ts b/private/aws-protocoltests-json-10/src/models/models_0.ts index 50ab097e73c1..b97f74007079 100644 --- a/private/aws-protocoltests-json-10/src/models/models_0.ts +++ b/private/aws-protocoltests-json-10/src/models/models_0.ts @@ -71,6 +71,18 @@ export class ComplexError extends __BaseException { } } +/** + * @public + */ +export interface ContentTypeParametersInput { + value?: number; +} + +/** + * @public + */ +export interface ContentTypeParametersOutput {} + /** * @public * @enum diff --git a/private/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts b/private/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts index 720c660b0290..1b9414953cc2 100644 --- a/private/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts +++ b/private/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts @@ -38,6 +38,10 @@ import { } from "@smithy/types"; import { v4 as generateIdempotencyToken } from "uuid"; +import { + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "../commands/ContentTypeParametersCommand"; import { EmptyInputAndEmptyOutputCommandInput, EmptyInputAndEmptyOutputCommandOutput, @@ -80,6 +84,7 @@ import { ClientOptionalDefaults, ComplexError, ComplexNestedErrorData, + ContentTypeParametersInput, Defaults, Dialog, EmptyInputAndEmptyOutputInput, @@ -102,6 +107,19 @@ import { TopLevel, } from "../models/models_0"; +/** + * serializeAws_json1_0ContentTypeParametersCommand + */ +export const se_ContentTypeParametersCommand = async ( + input: ContentTypeParametersCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = sharedHeaders("ContentTypeParameters"); + let body: any; + body = JSON.stringify(_json(input)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + /** * serializeAws_json1_0EmptyInputAndEmptyOutputCommand */ @@ -284,6 +302,26 @@ export const se_SimpleScalarPropertiesCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +/** + * deserializeAws_json1_0ContentTypeParametersCommand + */ +export const de_ContentTypeParametersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = _json(data); + const response: ContentTypeParametersCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return response; +}; + /** * deserializeAws_json1_0EmptyInputAndEmptyOutputCommand */ @@ -599,6 +637,8 @@ const de_InvalidGreetingRes = async (parsedOutput: any, context: __SerdeContext) // se_ClientOptionalDefaults omitted. +// se_ContentTypeParametersInput omitted. + /** * serializeAws_json1_0Defaults */ @@ -741,6 +781,8 @@ const de_ComplexNestedErrorData = (output: any, context: __SerdeContext): Comple }) as any; }; +// de_ContentTypeParametersOutput omitted. + // de_Dialog omitted. // de_DialogList omitted. diff --git a/private/aws-protocoltests-json-machinelearning/README.md b/private/aws-protocoltests-json-machinelearning/README.md index 3bfcf078d9f5..7ca350f4343f 100644 --- a/private/aws-protocoltests-json-machinelearning/README.md +++ b/private/aws-protocoltests-json-machinelearning/README.md @@ -400,6 +400,14 @@ XmlTimestamps [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/XmlTimestampsCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ContentTypeParametersCommandOutput/) +
@@ -536,6 +544,14 @@ SparseNullsOperation [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/SparseNullsOperationCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ContentTypeParametersCommandOutput/) +
@@ -944,6 +960,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ContentTypeParametersCommandOutput/) +
@@ -1536,6 +1560,22 @@ OmitsSerializingEmptyLists [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/OmitsSerializingEmptyListsCommandOutput/) +
+
+ +OperationWithDefaults + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/OperationWithDefaultsCommandOutput/) + +
+
+ +OperationWithNestedStructure + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/OperationWithNestedStructureCommandOutput/) +
@@ -1664,6 +1704,14 @@ TestBodyStructure [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/TestBodyStructureCommandOutput/) +
+
+ +TestNoInputNoPayload + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/TestNoInputNoPayloadCommandOutput/) +
@@ -1832,6 +1880,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/machine-learning/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-machine-learning/Interface/ContentTypeParametersCommandOutput/) +
diff --git a/private/aws-protocoltests-json/README.md b/private/aws-protocoltests-json/README.md index 77e0ff80f774..ea5f8c7b1b49 100644 --- a/private/aws-protocoltests-json/README.md +++ b/private/aws-protocoltests-json/README.md @@ -400,6 +400,14 @@ XmlTimestamps [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/XmlTimestampsCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -536,6 +544,14 @@ SparseNullsOperation [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/SparseNullsOperationCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -944,6 +960,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -1536,6 +1560,22 @@ OmitsSerializingEmptyLists [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/OmitsSerializingEmptyListsCommandOutput/) +
+
+ +OperationWithDefaults + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/OperationWithDefaultsCommandOutput/) + +
+
+ +OperationWithNestedStructure + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/OperationWithNestedStructureCommandOutput/) +
@@ -1664,6 +1704,14 @@ TestBodyStructure [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/TestBodyStructureCommandOutput/) +
+
+ +TestNoInputNoPayload + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/TestNoInputNoPayloadCommandOutput/) +
@@ -1832,6 +1880,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/json-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-json-protocol/Interface/ContentTypeParametersCommandOutput/) +
diff --git a/private/aws-protocoltests-json/src/JsonProtocol.ts b/private/aws-protocoltests-json/src/JsonProtocol.ts index 8f0ead7d5603..03b372f4bdcc 100644 --- a/private/aws-protocoltests-json/src/JsonProtocol.ts +++ b/private/aws-protocoltests-json/src/JsonProtocol.ts @@ -2,6 +2,11 @@ import { createAggregatedClient } from "@smithy/smithy-client"; import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types"; +import { + ContentTypeParametersCommand, + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "./commands/ContentTypeParametersCommand"; import { DatetimeOffsetsCommand, DatetimeOffsetsCommandInput, @@ -77,6 +82,7 @@ import { import { JsonProtocolClient, JsonProtocolClientConfig } from "./JsonProtocolClient"; const commands = { + ContentTypeParametersCommand, DatetimeOffsetsCommand, EmptyOperationCommand, EndpointOperationCommand, @@ -96,6 +102,24 @@ const commands = { }; export interface JsonProtocol { + /** + * @see {@link ContentTypeParametersCommand} + */ + contentTypeParameters(): Promise; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + cb: (err: any, data?: ContentTypeParametersCommandOutput) => void + ): void; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ContentTypeParametersCommandOutput) => void + ): void; + /** * @see {@link DatetimeOffsetsCommand} */ diff --git a/private/aws-protocoltests-json/src/JsonProtocolClient.ts b/private/aws-protocoltests-json/src/JsonProtocolClient.ts index 1aa745d8c409..94f7e0e8e8cc 100644 --- a/private/aws-protocoltests-json/src/JsonProtocolClient.ts +++ b/private/aws-protocoltests-json/src/JsonProtocolClient.ts @@ -60,6 +60,10 @@ import { HttpAuthSchemeResolvedConfig, resolveHttpAuthSchemeConfig, } from "./auth/httpAuthSchemeProvider"; +import { + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "./commands/ContentTypeParametersCommand"; import { DatetimeOffsetsCommandInput, DatetimeOffsetsCommandOutput } from "./commands/DatetimeOffsetsCommand"; import { EmptyOperationCommandInput, EmptyOperationCommandOutput } from "./commands/EmptyOperationCommand"; import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "./commands/EndpointOperationCommand"; @@ -109,6 +113,7 @@ export { __Client }; * @public */ export type ServiceInputTypes = + | ContentTypeParametersCommandInput | DatetimeOffsetsCommandInput | EmptyOperationCommandInput | EndpointOperationCommandInput @@ -130,6 +135,7 @@ export type ServiceInputTypes = * @public */ export type ServiceOutputTypes = + | ContentTypeParametersCommandOutput | DatetimeOffsetsCommandOutput | EmptyOperationCommandOutput | EndpointOperationCommandOutput diff --git a/private/aws-protocoltests-json/src/commands/ContentTypeParametersCommand.ts b/private/aws-protocoltests-json/src/commands/ContentTypeParametersCommand.ts new file mode 100644 index 000000000000..6ba9157e8257 --- /dev/null +++ b/private/aws-protocoltests-json/src/commands/ContentTypeParametersCommand.ts @@ -0,0 +1,73 @@ +// smithy-typescript generated code +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { JsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../JsonProtocolClient"; +import { ContentTypeParametersInput, ContentTypeParametersOutput } from "../models/models_0"; +import { de_ContentTypeParametersCommand, se_ContentTypeParametersCommand } from "../protocols/Aws_json1_1"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link ContentTypeParametersCommand}. + */ +export interface ContentTypeParametersCommandInput extends ContentTypeParametersInput {} +/** + * @public + * + * The output of {@link ContentTypeParametersCommand}. + */ +export interface ContentTypeParametersCommandOutput extends ContentTypeParametersOutput, __MetadataBearer {} + +/** + * The example tests how servers must support requests + * containing a `Content-Type` header with parameters. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { JsonProtocolClient, ContentTypeParametersCommand } from "@aws-sdk/aws-protocoltests-json"; // ES Modules import + * // const { JsonProtocolClient, ContentTypeParametersCommand } = require("@aws-sdk/aws-protocoltests-json"); // CommonJS import + * const client = new JsonProtocolClient(config); + * const input = { // ContentTypeParametersInput + * value: Number("int"), + * }; + * const command = new ContentTypeParametersCommand(input); + * const response = await client.send(command); + * // {}; + * + * ``` + * + * @param ContentTypeParametersCommandInput - {@link ContentTypeParametersCommandInput} + * @returns {@link ContentTypeParametersCommandOutput} + * @see {@link ContentTypeParametersCommandInput} for command's `input` shape. + * @see {@link ContentTypeParametersCommandOutput} for command's `response` shape. + * @see {@link JsonProtocolClientResolvedConfig | config} for JsonProtocolClient's `config` shape. + * + * @throws {@link JsonProtocolServiceException} + *

Base exception class for all service exceptions from JsonProtocol service.

+ * + * @public + */ +export class ContentTypeParametersCommand extends $Command + .classBuilder< + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, + JsonProtocolClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .m(function (this: any, Command: any, cs: any, config: JsonProtocolClientResolvedConfig, o: any) { + return [getSerdePlugin(config, this.serialize, this.deserialize)]; + }) + .s("JsonProtocol", "ContentTypeParameters", {}) + .n("JsonProtocolClient", "ContentTypeParametersCommand") + .f(void 0, void 0) + .ser(se_ContentTypeParametersCommand) + .de(de_ContentTypeParametersCommand) + .build() {} diff --git a/private/aws-protocoltests-json/src/commands/index.ts b/private/aws-protocoltests-json/src/commands/index.ts index 21bd9c97ccb9..481cd11a7e66 100644 --- a/private/aws-protocoltests-json/src/commands/index.ts +++ b/private/aws-protocoltests-json/src/commands/index.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +export * from "./ContentTypeParametersCommand"; export * from "./DatetimeOffsetsCommand"; export * from "./EmptyOperationCommand"; export * from "./EndpointOperationCommand"; diff --git a/private/aws-protocoltests-json/src/models/models_0.ts b/private/aws-protocoltests-json/src/models/models_0.ts index 7838c446d266..bed27fea8187 100644 --- a/private/aws-protocoltests-json/src/models/models_0.ts +++ b/private/aws-protocoltests-json/src/models/models_0.ts @@ -61,6 +61,18 @@ export class ComplexError extends __BaseException { } } +/** + * @public + */ +export interface ContentTypeParametersInput { + value?: number; +} + +/** + * @public + */ +export interface ContentTypeParametersOutput {} + /** * @public */ diff --git a/private/aws-protocoltests-json/src/protocols/Aws_json1_1.ts b/private/aws-protocoltests-json/src/protocols/Aws_json1_1.ts index 68e0b37495b9..a9f679d89dbe 100644 --- a/private/aws-protocoltests-json/src/protocols/Aws_json1_1.ts +++ b/private/aws-protocoltests-json/src/protocols/Aws_json1_1.ts @@ -41,6 +41,10 @@ import { } from "@smithy/types"; import { v4 as generateIdempotencyToken } from "uuid"; +import { + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "../commands/ContentTypeParametersCommand"; import { DatetimeOffsetsCommandInput, DatetimeOffsetsCommandOutput } from "../commands/DatetimeOffsetsCommand"; import { EmptyOperationCommandInput, EmptyOperationCommandOutput } from "../commands/EmptyOperationCommand"; import { EndpointOperationCommandInput, EndpointOperationCommandOutput } from "../commands/EndpointOperationCommand"; @@ -85,6 +89,7 @@ import { JsonProtocolServiceException as __BaseException } from "../models/JsonP import { ComplexError, ComplexNestedErrorData, + ContentTypeParametersInput, DatetimeOffsetsOutput, EmptyStruct, ErrorWithMembers, @@ -109,6 +114,19 @@ import { UnionInputOutput, } from "../models/models_0"; +/** + * serializeAws_json1_1ContentTypeParametersCommand + */ +export const se_ContentTypeParametersCommand = async ( + input: ContentTypeParametersCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = sharedHeaders("ContentTypeParameters"); + let body: any; + body = JSON.stringify(_json(input)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + /** * serializeAws_json1_1DatetimeOffsetsCommand */ @@ -329,6 +347,26 @@ export const se_SparseNullsOperationCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +/** + * deserializeAws_json1_1ContentTypeParametersCommand + */ +export const de_ContentTypeParametersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = _json(data); + const response: ContentTypeParametersCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return response; +}; + /** * deserializeAws_json1_1DatetimeOffsetsCommand */ @@ -734,6 +772,8 @@ const de_InvalidGreetingRes = async (parsedOutput: any, context: __SerdeContext) return __decorateServiceException(exception, body); }; +// se_ContentTypeParametersInput omitted. + /** * serializeAws_json1_1Document */ @@ -952,6 +992,8 @@ const de_ComplexNestedErrorData = (output: any, context: __SerdeContext): Comple }) as any; }; +// de_ContentTypeParametersOutput omitted. + /** * deserializeAws_json1_1DatetimeOffsetsOutput */ diff --git a/private/aws-protocoltests-query/README.md b/private/aws-protocoltests-query/README.md index 0dca0522ed55..2da35828a887 100644 --- a/private/aws-protocoltests-query/README.md +++ b/private/aws-protocoltests-query/README.md @@ -402,6 +402,14 @@ XmlTimestamps [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/XmlTimestampsCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -538,6 +546,14 @@ SparseNullsOperation [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/SparseNullsOperationCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -946,6 +962,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -1538,6 +1562,22 @@ OmitsSerializingEmptyLists [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/OmitsSerializingEmptyListsCommandOutput/) +
+
+ +OperationWithDefaults + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/OperationWithDefaultsCommandOutput/) + +
+
+ +OperationWithNestedStructure + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/OperationWithNestedStructureCommandOutput/) +
@@ -1666,6 +1706,14 @@ TestBodyStructure [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/TestBodyStructureCommandOutput/) +
+
+ +TestNoInputNoPayload + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/TestNoInputNoPayloadCommandOutput/) +
@@ -1834,6 +1882,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/query-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-query-protocol/Interface/ContentTypeParametersCommandOutput/) +
diff --git a/private/aws-protocoltests-restjson-apigateway/README.md b/private/aws-protocoltests-restjson-apigateway/README.md index 2dc572ca25f4..e1b62b0f73f3 100644 --- a/private/aws-protocoltests-restjson-apigateway/README.md +++ b/private/aws-protocoltests-restjson-apigateway/README.md @@ -400,6 +400,14 @@ XmlTimestamps [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/XmlTimestampsCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ContentTypeParametersCommandOutput/) +
@@ -536,6 +544,14 @@ SparseNullsOperation [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/SparseNullsOperationCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ContentTypeParametersCommandOutput/) +
@@ -944,6 +960,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ContentTypeParametersCommandOutput/) +
@@ -1536,6 +1560,22 @@ OmitsSerializingEmptyLists [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/OmitsSerializingEmptyListsCommandOutput/) +
+
+ +OperationWithDefaults + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/OperationWithDefaultsCommandOutput/) + +
+
+ +OperationWithNestedStructure + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/OperationWithNestedStructureCommandOutput/) +
@@ -1664,6 +1704,14 @@ TestBodyStructure [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/TestBodyStructureCommandOutput/) +
+
+ +TestNoInputNoPayload + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/TestNoInputNoPayloadCommandOutput/) +
@@ -1832,6 +1880,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/api-gateway/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-api-gateway/Interface/ContentTypeParametersCommandOutput/) +
diff --git a/private/aws-protocoltests-restjson-glacier/README.md b/private/aws-protocoltests-restjson-glacier/README.md index fdcb012a545e..727eeca5f84f 100644 --- a/private/aws-protocoltests-restjson-glacier/README.md +++ b/private/aws-protocoltests-restjson-glacier/README.md @@ -400,6 +400,14 @@ XmlTimestamps [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/XmlTimestampsCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ContentTypeParametersCommandOutput/) +
@@ -536,6 +544,14 @@ SparseNullsOperation [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/SparseNullsOperationCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ContentTypeParametersCommandOutput/) +
@@ -944,6 +960,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ContentTypeParametersCommandOutput/) +
@@ -1536,6 +1560,22 @@ OmitsSerializingEmptyLists [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/OmitsSerializingEmptyListsCommandOutput/) +
+
+ +OperationWithDefaults + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/OperationWithDefaultsCommandOutput/) + +
+
+ +OperationWithNestedStructure + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/OperationWithNestedStructureCommandOutput/) +
@@ -1664,6 +1704,14 @@ TestBodyStructure [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/TestBodyStructureCommandOutput/) +
+
+ +TestNoInputNoPayload + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/TestNoInputNoPayloadCommandOutput/) +
@@ -1832,6 +1880,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/glacier/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-glacier/Interface/ContentTypeParametersCommandOutput/) +
diff --git a/private/aws-protocoltests-restjson/README.md b/private/aws-protocoltests-restjson/README.md index dc0b8398d780..b4276c32cdca 100644 --- a/private/aws-protocoltests-restjson/README.md +++ b/private/aws-protocoltests-restjson/README.md @@ -402,6 +402,14 @@ XmlTimestamps [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/XmlTimestampsCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -538,6 +546,14 @@ SparseNullsOperation [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/SparseNullsOperationCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -946,6 +962,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -1538,6 +1562,22 @@ OmitsSerializingEmptyLists [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/OmitsSerializingEmptyListsCommandOutput/) +
+
+ +OperationWithDefaults + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/OperationWithDefaultsCommandOutput/) + +
+
+ +OperationWithNestedStructure + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/OperationWithNestedStructureCommandOutput/) +
@@ -1666,6 +1706,14 @@ TestBodyStructure [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/TestBodyStructureCommandOutput/) +
+
+ +TestNoInputNoPayload + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/TestNoInputNoPayloadCommandOutput/) +
@@ -1834,6 +1882,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-json-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-json-protocol/Interface/ContentTypeParametersCommandOutput/) +
diff --git a/private/aws-protocoltests-restjson/src/RestJsonProtocol.ts b/private/aws-protocoltests-restjson/src/RestJsonProtocol.ts index f607ce1f76f9..1be15d39aaf7 100644 --- a/private/aws-protocoltests-restjson/src/RestJsonProtocol.ts +++ b/private/aws-protocoltests-restjson/src/RestJsonProtocol.ts @@ -17,6 +17,11 @@ import { ConstantQueryStringCommandInput, ConstantQueryStringCommandOutput, } from "./commands/ConstantQueryStringCommand"; +import { + ContentTypeParametersCommand, + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "./commands/ContentTypeParametersCommand"; import { DatetimeOffsetsCommand, DatetimeOffsetsCommandInput, @@ -362,6 +367,16 @@ import { OmitsSerializingEmptyListsCommandInput, OmitsSerializingEmptyListsCommandOutput, } from "./commands/OmitsSerializingEmptyListsCommand"; +import { + OperationWithDefaultsCommand, + OperationWithDefaultsCommandInput, + OperationWithDefaultsCommandOutput, +} from "./commands/OperationWithDefaultsCommand"; +import { + OperationWithNestedStructureCommand, + OperationWithNestedStructureCommandInput, + OperationWithNestedStructureCommandOutput, +} from "./commands/OperationWithNestedStructureCommand"; import { PostPlayerActionCommand, PostPlayerActionCommandInput, @@ -432,6 +447,11 @@ import { TestBodyStructureCommandInput, TestBodyStructureCommandOutput, } from "./commands/TestBodyStructureCommand"; +import { + TestNoInputNoPayloadCommand, + TestNoInputNoPayloadCommandInput, + TestNoInputNoPayloadCommandOutput, +} from "./commands/TestNoInputNoPayloadCommand"; import { TestNoPayloadCommand, TestNoPayloadCommandInput, @@ -463,6 +483,7 @@ const commands = { AllQueryStringTypesCommand, ConstantAndVariableQueryStringCommand, ConstantQueryStringCommand, + ContentTypeParametersCommand, DatetimeOffsetsCommand, DocumentTypeCommand, DocumentTypeAsMapValueCommand, @@ -536,6 +557,8 @@ const commands = { NullAndEmptyHeadersServerCommand, OmitsNullSerializesEmptyStringCommand, OmitsSerializingEmptyListsCommand, + OperationWithDefaultsCommand, + OperationWithNestedStructureCommand, PostPlayerActionCommand, PostUnionWithJsonNameCommand, PutWithContentEncodingCommand, @@ -550,6 +573,7 @@ const commands = { StreamingTraitsRequireLengthCommand, StreamingTraitsWithMediaTypeCommand, TestBodyStructureCommand, + TestNoInputNoPayloadCommand, TestNoPayloadCommand, TestPayloadBlobCommand, TestPayloadStructureCommand, @@ -611,6 +635,24 @@ export interface RestJsonProtocol { cb: (err: any, data?: ConstantQueryStringCommandOutput) => void ): void; + /** + * @see {@link ContentTypeParametersCommand} + */ + contentTypeParameters(): Promise; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + cb: (err: any, data?: ContentTypeParametersCommandOutput) => void + ): void; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ContentTypeParametersCommandOutput) => void + ): void; + /** * @see {@link DatetimeOffsetsCommand} */ @@ -1801,6 +1843,41 @@ export interface RestJsonProtocol { cb: (err: any, data?: OmitsSerializingEmptyListsCommandOutput) => void ): void; + /** + * @see {@link OperationWithDefaultsCommand} + */ + operationWithDefaults(): Promise; + operationWithDefaults( + args: OperationWithDefaultsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + operationWithDefaults( + args: OperationWithDefaultsCommandInput, + cb: (err: any, data?: OperationWithDefaultsCommandOutput) => void + ): void; + operationWithDefaults( + args: OperationWithDefaultsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: OperationWithDefaultsCommandOutput) => void + ): void; + + /** + * @see {@link OperationWithNestedStructureCommand} + */ + operationWithNestedStructure( + args: OperationWithNestedStructureCommandInput, + options?: __HttpHandlerOptions + ): Promise; + operationWithNestedStructure( + args: OperationWithNestedStructureCommandInput, + cb: (err: any, data?: OperationWithNestedStructureCommandOutput) => void + ): void; + operationWithNestedStructure( + args: OperationWithNestedStructureCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: OperationWithNestedStructureCommandOutput) => void + ): void; + /** * @see {@link PostPlayerActionCommand} */ @@ -2038,6 +2115,24 @@ export interface RestJsonProtocol { cb: (err: any, data?: TestBodyStructureCommandOutput) => void ): void; + /** + * @see {@link TestNoInputNoPayloadCommand} + */ + testNoInputNoPayload(): Promise; + testNoInputNoPayload( + args: TestNoInputNoPayloadCommandInput, + options?: __HttpHandlerOptions + ): Promise; + testNoInputNoPayload( + args: TestNoInputNoPayloadCommandInput, + cb: (err: any, data?: TestNoInputNoPayloadCommandOutput) => void + ): void; + testNoInputNoPayload( + args: TestNoInputNoPayloadCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: TestNoInputNoPayloadCommandOutput) => void + ): void; + /** * @see {@link TestNoPayloadCommand} */ diff --git a/private/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts b/private/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts index de1a441dfcdc..9c8779e21d26 100644 --- a/private/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts +++ b/private/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts @@ -76,6 +76,10 @@ import { ConstantQueryStringCommandInput, ConstantQueryStringCommandOutput, } from "./commands/ConstantQueryStringCommand"; +import { + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "./commands/ContentTypeParametersCommand"; import { DatetimeOffsetsCommandInput, DatetimeOffsetsCommandOutput } from "./commands/DatetimeOffsetsCommand"; import { DocumentTypeAsMapValueCommandInput, @@ -272,6 +276,14 @@ import { OmitsSerializingEmptyListsCommandInput, OmitsSerializingEmptyListsCommandOutput, } from "./commands/OmitsSerializingEmptyListsCommand"; +import { + OperationWithDefaultsCommandInput, + OperationWithDefaultsCommandOutput, +} from "./commands/OperationWithDefaultsCommand"; +import { + OperationWithNestedStructureCommandInput, + OperationWithNestedStructureCommandOutput, +} from "./commands/OperationWithNestedStructureCommand"; import { PostPlayerActionCommandInput, PostPlayerActionCommandOutput } from "./commands/PostPlayerActionCommand"; import { PostUnionWithJsonNameCommandInput, @@ -307,6 +319,10 @@ import { StreamingTraitsWithMediaTypeCommandOutput, } from "./commands/StreamingTraitsWithMediaTypeCommand"; import { TestBodyStructureCommandInput, TestBodyStructureCommandOutput } from "./commands/TestBodyStructureCommand"; +import { + TestNoInputNoPayloadCommandInput, + TestNoInputNoPayloadCommandOutput, +} from "./commands/TestNoInputNoPayloadCommand"; import { TestNoPayloadCommandInput, TestNoPayloadCommandOutput } from "./commands/TestNoPayloadCommand"; import { TestPayloadBlobCommandInput, TestPayloadBlobCommandOutput } from "./commands/TestPayloadBlobCommand"; import { @@ -330,6 +346,7 @@ export type ServiceInputTypes = | AllQueryStringTypesCommandInput | ConstantAndVariableQueryStringCommandInput | ConstantQueryStringCommandInput + | ContentTypeParametersCommandInput | DatetimeOffsetsCommandInput | DocumentTypeAsMapValueCommandInput | DocumentTypeAsPayloadCommandInput @@ -403,6 +420,8 @@ export type ServiceInputTypes = | NullAndEmptyHeadersServerCommandInput | OmitsNullSerializesEmptyStringCommandInput | OmitsSerializingEmptyListsCommandInput + | OperationWithDefaultsCommandInput + | OperationWithNestedStructureCommandInput | PostPlayerActionCommandInput | PostUnionWithJsonNameCommandInput | PutWithContentEncodingCommandInput @@ -417,6 +436,7 @@ export type ServiceInputTypes = | StreamingTraitsRequireLengthCommandInput | StreamingTraitsWithMediaTypeCommandInput | TestBodyStructureCommandInput + | TestNoInputNoPayloadCommandInput | TestNoPayloadCommandInput | TestPayloadBlobCommandInput | TestPayloadStructureCommandInput @@ -430,6 +450,7 @@ export type ServiceOutputTypes = | AllQueryStringTypesCommandOutput | ConstantAndVariableQueryStringCommandOutput | ConstantQueryStringCommandOutput + | ContentTypeParametersCommandOutput | DatetimeOffsetsCommandOutput | DocumentTypeAsMapValueCommandOutput | DocumentTypeAsPayloadCommandOutput @@ -503,6 +524,8 @@ export type ServiceOutputTypes = | NullAndEmptyHeadersServerCommandOutput | OmitsNullSerializesEmptyStringCommandOutput | OmitsSerializingEmptyListsCommandOutput + | OperationWithDefaultsCommandOutput + | OperationWithNestedStructureCommandOutput | PostPlayerActionCommandOutput | PostUnionWithJsonNameCommandOutput | PutWithContentEncodingCommandOutput @@ -517,6 +540,7 @@ export type ServiceOutputTypes = | StreamingTraitsRequireLengthCommandOutput | StreamingTraitsWithMediaTypeCommandOutput | TestBodyStructureCommandOutput + | TestNoInputNoPayloadCommandOutput | TestNoPayloadCommandOutput | TestPayloadBlobCommandOutput | TestPayloadStructureCommandOutput diff --git a/private/aws-protocoltests-restjson/src/commands/ContentTypeParametersCommand.ts b/private/aws-protocoltests-restjson/src/commands/ContentTypeParametersCommand.ts new file mode 100644 index 000000000000..50bee2365766 --- /dev/null +++ b/private/aws-protocoltests-restjson/src/commands/ContentTypeParametersCommand.ts @@ -0,0 +1,73 @@ +// smithy-typescript generated code +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { ContentTypeParametersInput, ContentTypeParametersOutput } from "../models/models_0"; +import { de_ContentTypeParametersCommand, se_ContentTypeParametersCommand } from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link ContentTypeParametersCommand}. + */ +export interface ContentTypeParametersCommandInput extends ContentTypeParametersInput {} +/** + * @public + * + * The output of {@link ContentTypeParametersCommand}. + */ +export interface ContentTypeParametersCommandOutput extends ContentTypeParametersOutput, __MetadataBearer {} + +/** + * The example tests how servers must support requests + * containing a `Content-Type` header with parameters. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, ContentTypeParametersCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, ContentTypeParametersCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const input = { // ContentTypeParametersInput + * value: Number("int"), + * }; + * const command = new ContentTypeParametersCommand(input); + * const response = await client.send(command); + * // {}; + * + * ``` + * + * @param ContentTypeParametersCommandInput - {@link ContentTypeParametersCommandInput} + * @returns {@link ContentTypeParametersCommandOutput} + * @see {@link ContentTypeParametersCommandInput} for command's `input` shape. + * @see {@link ContentTypeParametersCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for RestJsonProtocolClient's `config` shape. + * + * @throws {@link RestJsonProtocolServiceException} + *

Base exception class for all service exceptions from RestJsonProtocol service.

+ * + * @public + */ +export class ContentTypeParametersCommand extends $Command + .classBuilder< + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, + RestJsonProtocolClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .m(function (this: any, Command: any, cs: any, config: RestJsonProtocolClientResolvedConfig, o: any) { + return [getSerdePlugin(config, this.serialize, this.deserialize)]; + }) + .s("RestJson", "ContentTypeParameters", {}) + .n("RestJsonProtocolClient", "ContentTypeParametersCommand") + .f(void 0, void 0) + .ser(se_ContentTypeParametersCommand) + .de(de_ContentTypeParametersCommand) + .build() {} diff --git a/private/aws-protocoltests-restjson/src/commands/OperationWithDefaultsCommand.ts b/private/aws-protocoltests-restjson/src/commands/OperationWithDefaultsCommand.ts new file mode 100644 index 000000000000..99e5297ae7cc --- /dev/null +++ b/private/aws-protocoltests-restjson/src/commands/OperationWithDefaultsCommand.ts @@ -0,0 +1,143 @@ +// smithy-typescript generated code +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { OperationWithDefaultsInput, OperationWithDefaultsOutput } from "../models/models_0"; +import { de_OperationWithDefaultsCommand, se_OperationWithDefaultsCommand } from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link OperationWithDefaultsCommand}. + */ +export interface OperationWithDefaultsCommandInput extends OperationWithDefaultsInput {} +/** + * @public + * + * The output of {@link OperationWithDefaultsCommand}. + */ +export interface OperationWithDefaultsCommandOutput extends OperationWithDefaultsOutput, __MetadataBearer {} + +/** + * @public + * + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, OperationWithDefaultsCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, OperationWithDefaultsCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const input = { // OperationWithDefaultsInput + * defaults: { // Defaults + * defaultString: "STRING_VALUE", + * defaultBoolean: true || false, + * defaultList: [ // TestStringList + * "STRING_VALUE", + * ], + * defaultDocumentMap: "DOCUMENT_VALUE", + * defaultDocumentString: "DOCUMENT_VALUE", + * defaultDocumentBoolean: "DOCUMENT_VALUE", + * defaultDocumentList: "DOCUMENT_VALUE", + * defaultNullDocument: "DOCUMENT_VALUE", + * defaultTimestamp: new Date("TIMESTAMP"), + * defaultBlob: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * defaultByte: 0, // BYTE_VALUE + * defaultShort: Number("short"), + * defaultInteger: Number("int"), + * defaultLong: Number("long"), + * defaultFloat: Number("float"), + * defaultDouble: Number("double"), + * defaultMap: { // TestStringMap + * "": "STRING_VALUE", + * }, + * defaultEnum: "FOO" || "BAR" || "BAZ", + * defaultIntEnum: 1 || 2, + * emptyString: "STRING_VALUE", + * falseBoolean: true || false, + * emptyBlob: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * zeroByte: 0, // BYTE_VALUE + * zeroShort: Number("short"), + * zeroInteger: Number("int"), + * zeroLong: Number("long"), + * zeroFloat: Number("float"), + * zeroDouble: Number("double"), + * }, + * clientOptionalDefaults: { // ClientOptionalDefaults + * member: Number("int"), + * }, + * topLevelDefault: "STRING_VALUE", + * otherTopLevelDefault: Number("int"), + * }; + * const command = new OperationWithDefaultsCommand(input); + * const response = await client.send(command); + * // { // OperationWithDefaultsOutput + * // defaultString: "STRING_VALUE", + * // defaultBoolean: true || false, + * // defaultList: [ // TestStringList + * // "STRING_VALUE", + * // ], + * // defaultDocumentMap: "DOCUMENT_VALUE", + * // defaultDocumentString: "DOCUMENT_VALUE", + * // defaultDocumentBoolean: "DOCUMENT_VALUE", + * // defaultDocumentList: "DOCUMENT_VALUE", + * // defaultNullDocument: "DOCUMENT_VALUE", + * // defaultTimestamp: new Date("TIMESTAMP"), + * // defaultBlob: new Uint8Array(), + * // defaultByte: 0, // BYTE_VALUE + * // defaultShort: Number("short"), + * // defaultInteger: Number("int"), + * // defaultLong: Number("long"), + * // defaultFloat: Number("float"), + * // defaultDouble: Number("double"), + * // defaultMap: { // TestStringMap + * // "": "STRING_VALUE", + * // }, + * // defaultEnum: "FOO" || "BAR" || "BAZ", + * // defaultIntEnum: 1 || 2, + * // emptyString: "STRING_VALUE", + * // falseBoolean: true || false, + * // emptyBlob: new Uint8Array(), + * // zeroByte: 0, // BYTE_VALUE + * // zeroShort: Number("short"), + * // zeroInteger: Number("int"), + * // zeroLong: Number("long"), + * // zeroFloat: Number("float"), + * // zeroDouble: Number("double"), + * // }; + * + * ``` + * + * @param OperationWithDefaultsCommandInput - {@link OperationWithDefaultsCommandInput} + * @returns {@link OperationWithDefaultsCommandOutput} + * @see {@link OperationWithDefaultsCommandInput} for command's `input` shape. + * @see {@link OperationWithDefaultsCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for RestJsonProtocolClient's `config` shape. + * + * @throws {@link RestJsonProtocolServiceException} + *

Base exception class for all service exceptions from RestJsonProtocol service.

+ * + */ +export class OperationWithDefaultsCommand extends $Command + .classBuilder< + OperationWithDefaultsCommandInput, + OperationWithDefaultsCommandOutput, + RestJsonProtocolClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .m(function (this: any, Command: any, cs: any, config: RestJsonProtocolClientResolvedConfig, o: any) { + return [getSerdePlugin(config, this.serialize, this.deserialize)]; + }) + .s("RestJson", "OperationWithDefaults", {}) + .n("RestJsonProtocolClient", "OperationWithDefaultsCommand") + .f(void 0, void 0) + .ser(se_OperationWithDefaultsCommand) + .de(de_OperationWithDefaultsCommand) + .build() {} diff --git a/private/aws-protocoltests-restjson/src/commands/OperationWithNestedStructureCommand.ts b/private/aws-protocoltests-restjson/src/commands/OperationWithNestedStructureCommand.ts new file mode 100644 index 000000000000..8df9068bc72c --- /dev/null +++ b/private/aws-protocoltests-restjson/src/commands/OperationWithNestedStructureCommand.ts @@ -0,0 +1,129 @@ +// smithy-typescript generated code +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { OperationWithNestedStructureInput, OperationWithNestedStructureOutput } from "../models/models_0"; +import { + de_OperationWithNestedStructureCommand, + se_OperationWithNestedStructureCommand, +} from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link OperationWithNestedStructureCommand}. + */ +export interface OperationWithNestedStructureCommandInput extends OperationWithNestedStructureInput {} +/** + * @public + * + * The output of {@link OperationWithNestedStructureCommand}. + */ +export interface OperationWithNestedStructureCommandOutput + extends OperationWithNestedStructureOutput, + __MetadataBearer {} + +/** + * @public + * + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, OperationWithNestedStructureCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, OperationWithNestedStructureCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const input = { // OperationWithNestedStructureInput + * topLevel: { // TopLevel + * dialog: { // Dialog + * language: "STRING_VALUE", + * greeting: "STRING_VALUE", + * farewell: { // Farewell + * phrase: "STRING_VALUE", + * }, + * }, + * dialogList: [ // DialogList + * { + * language: "STRING_VALUE", + * greeting: "STRING_VALUE", + * farewell: { + * phrase: "STRING_VALUE", + * }, + * }, + * ], + * dialogMap: { // DialogMap + * "": { + * language: "STRING_VALUE", + * greeting: "STRING_VALUE", + * farewell: { + * phrase: "STRING_VALUE", + * }, + * }, + * }, + * }, + * }; + * const command = new OperationWithNestedStructureCommand(input); + * const response = await client.send(command); + * // { // OperationWithNestedStructureOutput + * // dialog: { // Dialog + * // language: "STRING_VALUE", + * // greeting: "STRING_VALUE", + * // farewell: { // Farewell + * // phrase: "STRING_VALUE", + * // }, + * // }, + * // dialogList: [ // DialogList + * // { + * // language: "STRING_VALUE", + * // greeting: "STRING_VALUE", + * // farewell: { + * // phrase: "STRING_VALUE", + * // }, + * // }, + * // ], + * // dialogMap: { // DialogMap + * // "": { + * // language: "STRING_VALUE", + * // greeting: "STRING_VALUE", + * // farewell: { + * // phrase: "STRING_VALUE", + * // }, + * // }, + * // }, + * // }; + * + * ``` + * + * @param OperationWithNestedStructureCommandInput - {@link OperationWithNestedStructureCommandInput} + * @returns {@link OperationWithNestedStructureCommandOutput} + * @see {@link OperationWithNestedStructureCommandInput} for command's `input` shape. + * @see {@link OperationWithNestedStructureCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for RestJsonProtocolClient's `config` shape. + * + * @throws {@link RestJsonProtocolServiceException} + *

Base exception class for all service exceptions from RestJsonProtocol service.

+ * + */ +export class OperationWithNestedStructureCommand extends $Command + .classBuilder< + OperationWithNestedStructureCommandInput, + OperationWithNestedStructureCommandOutput, + RestJsonProtocolClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .m(function (this: any, Command: any, cs: any, config: RestJsonProtocolClientResolvedConfig, o: any) { + return [getSerdePlugin(config, this.serialize, this.deserialize)]; + }) + .s("RestJson", "OperationWithNestedStructure", {}) + .n("RestJsonProtocolClient", "OperationWithNestedStructureCommand") + .f(void 0, void 0) + .ser(se_OperationWithNestedStructureCommand) + .de(de_OperationWithNestedStructureCommand) + .build() {} diff --git a/private/aws-protocoltests-restjson/src/commands/TestNoInputNoPayloadCommand.ts b/private/aws-protocoltests-restjson/src/commands/TestNoInputNoPayloadCommand.ts new file mode 100644 index 000000000000..e97d085aab78 --- /dev/null +++ b/private/aws-protocoltests-restjson/src/commands/TestNoInputNoPayloadCommand.ts @@ -0,0 +1,77 @@ +// smithy-typescript generated code +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { TestNoPayloadInputOutput } from "../models/models_0"; +import { de_TestNoInputNoPayloadCommand, se_TestNoInputNoPayloadCommand } from "../protocols/Aws_restJson1"; +import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link TestNoInputNoPayloadCommand}. + */ +export interface TestNoInputNoPayloadCommandInput {} +/** + * @public + * + * The output of {@link TestNoInputNoPayloadCommand}. + */ +export interface TestNoInputNoPayloadCommandOutput extends TestNoPayloadInputOutput, __MetadataBearer {} + +/** + * This example operation has no input and serializes a request without an HTTP body. + * + * These tests are to ensure we do not attach a body or related headers + * (Content-Length, Content-Type) to operations that semantically + * cannot produce an HTTP body. + * + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestJsonProtocolClient, TestNoInputNoPayloadCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import + * // const { RestJsonProtocolClient, TestNoInputNoPayloadCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import + * const client = new RestJsonProtocolClient(config); + * const input = {}; + * const command = new TestNoInputNoPayloadCommand(input); + * const response = await client.send(command); + * // { // TestNoPayloadInputOutput + * // testId: "STRING_VALUE", + * // }; + * + * ``` + * + * @param TestNoInputNoPayloadCommandInput - {@link TestNoInputNoPayloadCommandInput} + * @returns {@link TestNoInputNoPayloadCommandOutput} + * @see {@link TestNoInputNoPayloadCommandInput} for command's `input` shape. + * @see {@link TestNoInputNoPayloadCommandOutput} for command's `response` shape. + * @see {@link RestJsonProtocolClientResolvedConfig | config} for RestJsonProtocolClient's `config` shape. + * + * @throws {@link RestJsonProtocolServiceException} + *

Base exception class for all service exceptions from RestJsonProtocol service.

+ * + * @public + */ +export class TestNoInputNoPayloadCommand extends $Command + .classBuilder< + TestNoInputNoPayloadCommandInput, + TestNoInputNoPayloadCommandOutput, + RestJsonProtocolClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .m(function (this: any, Command: any, cs: any, config: RestJsonProtocolClientResolvedConfig, o: any) { + return [getSerdePlugin(config, this.serialize, this.deserialize)]; + }) + .s("RestJson", "TestNoInputNoPayload", {}) + .n("RestJsonProtocolClient", "TestNoInputNoPayloadCommand") + .f(void 0, void 0) + .ser(se_TestNoInputNoPayloadCommand) + .de(de_TestNoInputNoPayloadCommand) + .build() {} diff --git a/private/aws-protocoltests-restjson/src/commands/index.ts b/private/aws-protocoltests-restjson/src/commands/index.ts index 2f5033393326..e75203cd3311 100644 --- a/private/aws-protocoltests-restjson/src/commands/index.ts +++ b/private/aws-protocoltests-restjson/src/commands/index.ts @@ -2,6 +2,7 @@ export * from "./AllQueryStringTypesCommand"; export * from "./ConstantAndVariableQueryStringCommand"; export * from "./ConstantQueryStringCommand"; +export * from "./ContentTypeParametersCommand"; export * from "./DatetimeOffsetsCommand"; export * from "./DocumentTypeAsMapValueCommand"; export * from "./DocumentTypeAsPayloadCommand"; @@ -75,6 +76,8 @@ export * from "./NullAndEmptyHeadersClientCommand"; export * from "./NullAndEmptyHeadersServerCommand"; export * from "./OmitsNullSerializesEmptyStringCommand"; export * from "./OmitsSerializingEmptyListsCommand"; +export * from "./OperationWithDefaultsCommand"; +export * from "./OperationWithNestedStructureCommand"; export * from "./PostPlayerActionCommand"; export * from "./PostUnionWithJsonNameCommand"; export * from "./PutWithContentEncodingCommand"; @@ -89,6 +92,7 @@ export * from "./StreamingTraitsCommand"; export * from "./StreamingTraitsRequireLengthCommand"; export * from "./StreamingTraitsWithMediaTypeCommand"; export * from "./TestBodyStructureCommand"; +export * from "./TestNoInputNoPayloadCommand"; export * from "./TestNoPayloadCommand"; export * from "./TestPayloadBlobCommand"; export * from "./TestPayloadStructureCommand"; diff --git a/private/aws-protocoltests-restjson/src/models/models_0.ts b/private/aws-protocoltests-restjson/src/models/models_0.ts index 4e10af5f727d..83894c0aa7e4 100644 --- a/private/aws-protocoltests-restjson/src/models/models_0.ts +++ b/private/aws-protocoltests-restjson/src/models/models_0.ts @@ -63,6 +63,13 @@ export interface AllQueryStringTypesInput { queryParamsMapOfStringList?: Record; } +/** + * @public + */ +export interface ClientOptionalDefaults { + member?: number; +} + /** * @public */ @@ -111,6 +118,18 @@ export interface ConstantQueryStringInput { hello: string | undefined; } +/** + * @public + */ +export interface ContentTypeParametersInput { + value?: number; +} + +/** + * @public + */ +export interface ContentTypeParametersOutput {} + /** * @public */ @@ -118,6 +137,75 @@ export interface DatetimeOffsetsOutput { datetime?: Date; } +/** + * @public + * @enum + */ +export const TestEnum = { + BAR: "BAR", + BAZ: "BAZ", + FOO: "FOO", +} as const; +/** + * @public + */ +export type TestEnum = (typeof TestEnum)[keyof typeof TestEnum]; + +export enum TestIntEnum { + ONE = 1, + TWO = 2, +} + +/** + * @public + */ +export interface Defaults { + defaultString?: string; + defaultBoolean?: boolean; + defaultList?: string[]; + defaultDocumentMap?: __DocumentType; + defaultDocumentString?: __DocumentType; + defaultDocumentBoolean?: __DocumentType; + defaultDocumentList?: __DocumentType; + defaultNullDocument?: __DocumentType; + defaultTimestamp?: Date; + defaultBlob?: Uint8Array; + defaultByte?: number; + defaultShort?: number; + defaultInteger?: number; + defaultLong?: number; + defaultFloat?: number; + defaultDouble?: number; + defaultMap?: Record; + defaultEnum?: TestEnum; + defaultIntEnum?: TestIntEnum; + emptyString?: string; + falseBoolean?: boolean; + emptyBlob?: Uint8Array; + zeroByte?: number; + zeroShort?: number; + zeroInteger?: number; + zeroLong?: number; + zeroFloat?: number; + zeroDouble?: number; +} + +/** + * @public + */ +export interface Farewell { + phrase?: string; +} + +/** + * @public + */ +export interface Dialog { + language?: string; + greeting?: string; + farewell?: Farewell; +} + /** * @public */ @@ -1069,6 +1157,75 @@ export interface OmitsSerializingEmptyListsInput { queryIntegerEnumList?: IntegerEnum[]; } +/** + * @public + */ +export interface OperationWithDefaultsInput { + defaults?: Defaults; + clientOptionalDefaults?: ClientOptionalDefaults; + topLevelDefault?: string; + otherTopLevelDefault?: number; +} + +/** + * @public + */ +export interface OperationWithDefaultsOutput { + defaultString?: string; + defaultBoolean?: boolean; + defaultList?: string[]; + defaultDocumentMap?: __DocumentType; + defaultDocumentString?: __DocumentType; + defaultDocumentBoolean?: __DocumentType; + defaultDocumentList?: __DocumentType; + defaultNullDocument?: __DocumentType; + defaultTimestamp?: Date; + defaultBlob?: Uint8Array; + defaultByte?: number; + defaultShort?: number; + defaultInteger?: number; + defaultLong?: number; + defaultFloat?: number; + defaultDouble?: number; + defaultMap?: Record; + defaultEnum?: TestEnum; + defaultIntEnum?: TestIntEnum; + emptyString?: string; + falseBoolean?: boolean; + emptyBlob?: Uint8Array; + zeroByte?: number; + zeroShort?: number; + zeroInteger?: number; + zeroLong?: number; + zeroFloat?: number; + zeroDouble?: number; +} + +/** + * @public + */ +export interface TopLevel { + dialog: Dialog | undefined; + dialogList?: Dialog[]; + dialogMap?: Record; +} + +/** + * @public + */ +export interface OperationWithNestedStructureInput { + topLevel: TopLevel | undefined; +} + +/** + * @public + */ +export interface OperationWithNestedStructureOutput { + dialog: Dialog | undefined; + dialogList?: Dialog[]; + dialogMap?: Record; +} + /** * @public */ diff --git a/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts b/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts index 6856fa584b9e..92dad884b5cf 100644 --- a/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts +++ b/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts @@ -69,6 +69,10 @@ import { ConstantQueryStringCommandInput, ConstantQueryStringCommandOutput, } from "../commands/ConstantQueryStringCommand"; +import { + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "../commands/ContentTypeParametersCommand"; import { DatetimeOffsetsCommandInput, DatetimeOffsetsCommandOutput } from "../commands/DatetimeOffsetsCommand"; import { DocumentTypeAsMapValueCommandInput, @@ -265,6 +269,14 @@ import { OmitsSerializingEmptyListsCommandInput, OmitsSerializingEmptyListsCommandOutput, } from "../commands/OmitsSerializingEmptyListsCommand"; +import { + OperationWithDefaultsCommandInput, + OperationWithDefaultsCommandOutput, +} from "../commands/OperationWithDefaultsCommand"; +import { + OperationWithNestedStructureCommandInput, + OperationWithNestedStructureCommandOutput, +} from "../commands/OperationWithNestedStructureCommand"; import { PostPlayerActionCommandInput, PostPlayerActionCommandOutput } from "../commands/PostPlayerActionCommand"; import { PostUnionWithJsonNameCommandInput, @@ -300,6 +312,10 @@ import { StreamingTraitsWithMediaTypeCommandOutput, } from "../commands/StreamingTraitsWithMediaTypeCommand"; import { TestBodyStructureCommandInput, TestBodyStructureCommandOutput } from "../commands/TestBodyStructureCommand"; +import { + TestNoInputNoPayloadCommandInput, + TestNoInputNoPayloadCommandOutput, +} from "../commands/TestNoInputNoPayloadCommand"; import { TestNoPayloadCommandInput, TestNoPayloadCommandOutput } from "../commands/TestNoPayloadCommand"; import { TestPayloadBlobCommandInput, TestPayloadBlobCommandOutput } from "../commands/TestPayloadBlobCommand"; import { @@ -312,8 +328,12 @@ import { } from "../commands/TimestampFormatHeadersCommand"; import { UnitInputAndOutputCommandInput, UnitInputAndOutputCommandOutput } from "../commands/UnitInputAndOutputCommand"; import { + ClientOptionalDefaults, ComplexError, ComplexNestedErrorData, + Defaults, + Dialog, + Farewell, FooEnum, FooError, GreetingStruct, @@ -329,6 +349,7 @@ import { SimpleUnion, StructureListMember, TestConfig, + TopLevel, UnionPayload, UnionWithJsonName, Unit, @@ -437,6 +458,28 @@ export const se_ConstantQueryStringCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1ContentTypeParametersCommand + */ +export const se_ContentTypeParametersCommand = async ( + input: ContentTypeParametersCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/ContentTypeParameters"); + let body: any; + body = JSON.stringify( + take(input, { + value: [], + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1DatetimeOffsetsCommand */ @@ -2043,6 +2086,53 @@ export const se_OmitsSerializingEmptyListsCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1OperationWithDefaultsCommand + */ +export const se_OperationWithDefaultsCommand = async ( + input: OperationWithDefaultsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/OperationWithDefaults"); + let body: any; + body = JSON.stringify( + take(input, { + clientOptionalDefaults: (_) => _json(_), + defaults: (_) => se_Defaults(_, context), + otherTopLevelDefault: [], + topLevelDefault: [], + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); +}; + +/** + * serializeAws_restJson1OperationWithNestedStructureCommand + */ +export const se_OperationWithNestedStructureCommand = async ( + input: OperationWithNestedStructureCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/OperationWithNestedStructure"); + let body: any; + body = JSON.stringify( + take(input, { + topLevel: (_) => _json(_), + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1PostPlayerActionCommand */ @@ -2353,6 +2443,21 @@ export const se_TestBodyStructureCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1TestNoInputNoPayloadCommand + */ +export const se_TestNoInputNoPayloadCommand = async ( + input: TestNoInputNoPayloadCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/no_input_no_payload"); + let body: any; + b.m("GET").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1TestNoPayloadCommand */ @@ -2504,6 +2609,23 @@ export const de_ConstantQueryStringCommand = async ( return contents; }; +/** + * deserializeAws_restJson1ContentTypeParametersCommand + */ +export const de_ContentTypeParametersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + await collectBody(output.body, context); + return contents; +}; + /** * deserializeAws_restJson1DatetimeOffsetsCommand */ @@ -3923,6 +4045,77 @@ export const de_OmitsSerializingEmptyListsCommand = async ( return contents; }; +/** + * deserializeAws_restJson1OperationWithDefaultsCommand + */ +export const de_OperationWithDefaultsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + defaultBlob: context.base64Decoder, + defaultBoolean: __expectBoolean, + defaultByte: __expectByte, + defaultDocumentBoolean: (_) => de_Document(_, context), + defaultDocumentList: (_) => de_Document(_, context), + defaultDocumentMap: (_) => de_Document(_, context), + defaultDocumentString: (_) => de_Document(_, context), + defaultDouble: __limitedParseDouble, + defaultEnum: __expectString, + defaultFloat: __limitedParseFloat32, + defaultIntEnum: __expectInt32, + defaultInteger: __expectInt32, + defaultList: _json, + defaultLong: __expectLong, + defaultMap: _json, + defaultNullDocument: (_) => de_Document(_, context), + defaultShort: __expectShort, + defaultString: __expectString, + defaultTimestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + emptyBlob: context.base64Decoder, + emptyString: __expectString, + falseBoolean: __expectBoolean, + zeroByte: __expectByte, + zeroDouble: __limitedParseDouble, + zeroFloat: __limitedParseFloat32, + zeroInteger: __expectInt32, + zeroLong: __expectLong, + zeroShort: __expectShort, + }); + Object.assign(contents, doc); + return contents; +}; + +/** + * deserializeAws_restJson1OperationWithNestedStructureCommand + */ +export const de_OperationWithNestedStructureCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + dialog: _json, + dialogList: _json, + dialogMap: _json, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1PostPlayerActionCommand */ @@ -4209,6 +4402,24 @@ export const de_TestBodyStructureCommand = async ( return contents; }; +/** + * deserializeAws_restJson1TestNoInputNoPayloadCommand + */ +export const de_TestNoInputNoPayloadCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + [_tI]: [, output.headers[_xati]], + }); + await collectBody(output.body, context); + return contents; +}; + /** * deserializeAws_restJson1TestNoPayloadCommand */ @@ -4400,6 +4611,44 @@ const de_InvalidGreetingRes = async (parsedOutput: any, context: __SerdeContext) return __decorateServiceException(exception, parsedOutput.body); }; +// se_ClientOptionalDefaults omitted. + +/** + * serializeAws_restJson1Defaults + */ +const se_Defaults = (input: Defaults, context: __SerdeContext): any => { + return take(input, { + defaultBlob: context.base64Encoder, + defaultBoolean: [], + defaultByte: [], + defaultDocumentBoolean: (_) => se_Document(_, context), + defaultDocumentList: (_) => se_Document(_, context), + defaultDocumentMap: (_) => se_Document(_, context), + defaultDocumentString: (_) => se_Document(_, context), + defaultDouble: __serializeFloat, + defaultEnum: [], + defaultFloat: __serializeFloat, + defaultIntEnum: [], + defaultInteger: [], + defaultList: _json, + defaultLong: [], + defaultMap: _json, + defaultNullDocument: (_) => se_Document(_, context), + defaultShort: [], + defaultString: [], + defaultTimestamp: (_) => _.getTime() / 1_000, + emptyBlob: context.base64Encoder, + emptyString: [], + falseBoolean: [], + zeroByte: [], + zeroDouble: __serializeFloat, + zeroFloat: __serializeFloat, + zeroInteger: [], + zeroLong: [], + zeroShort: [], + }); +}; + // se_DenseBooleanMap omitted. // se_DenseNumberMap omitted. @@ -4410,6 +4659,12 @@ const de_InvalidGreetingRes = async (parsedOutput: any, context: __SerdeContext) // se_DenseStructMap omitted. +// se_Dialog omitted. + +// se_DialogList omitted. + +// se_DialogMap omitted. + /** * serializeAws_restJson1Document */ @@ -4430,6 +4685,8 @@ const se_DocumentValuedMap = (input: Record, context: __ }, {}); }; +// se_Farewell omitted. + /** * serializeAws_restJson1MyUnion */ @@ -4566,6 +4823,12 @@ const se_StructureListMember = (input: StructureListMember, context: __SerdeCont // se_TestConfig omitted. +// se_TestStringList omitted. + +// se_TestStringMap omitted. + +// se_TopLevel omitted. + // se_UnionPayload omitted. /** @@ -4661,6 +4924,12 @@ const de_ComplexNestedErrorData = (output: any, context: __SerdeContext): Comple // de_DenseStructMap omitted. +// de_Dialog omitted. + +// de_DialogList omitted. + +// de_DialogMap omitted. + /** * deserializeAws_restJson1Document */ @@ -4681,6 +4950,8 @@ const de_DocumentValuedMap = (output: any, context: __SerdeContext): Record); }; +// de_Farewell omitted. + /** * deserializeAws_restJson1MyUnion */ @@ -4842,6 +5113,10 @@ const de_StructureListMember = (output: any, context: __SerdeContext): Structure // de_TestConfig omitted. +// de_TestStringList omitted. + +// de_TestStringMap omitted. + // de_UnionPayload omitted. /** diff --git a/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts b/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts index ee1840bcb94e..ee18d2ce4656 100644 --- a/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts +++ b/private/aws-protocoltests-restjson/test/functional/restjson1.spec.ts @@ -48,6 +48,8 @@ import { NoInputAndOutputCommand } from "../../src/commands/NoInputAndOutputComm import { NullAndEmptyHeadersClientCommand } from "../../src/commands/NullAndEmptyHeadersClientCommand"; import { OmitsNullSerializesEmptyStringCommand } from "../../src/commands/OmitsNullSerializesEmptyStringCommand"; import { OmitsSerializingEmptyListsCommand } from "../../src/commands/OmitsSerializingEmptyListsCommand"; +import { OperationWithDefaultsCommand } from "../../src/commands/OperationWithDefaultsCommand"; +import { OperationWithNestedStructureCommand } from "../../src/commands/OperationWithNestedStructureCommand"; import { PostPlayerActionCommand } from "../../src/commands/PostPlayerActionCommand"; import { PostUnionWithJsonNameCommand } from "../../src/commands/PostUnionWithJsonNameCommand"; import { PutWithContentEncodingCommand } from "../../src/commands/PutWithContentEncodingCommand"; @@ -62,6 +64,7 @@ import { StreamingTraitsCommand } from "../../src/commands/StreamingTraitsComman import { StreamingTraitsRequireLengthCommand } from "../../src/commands/StreamingTraitsRequireLengthCommand"; import { StreamingTraitsWithMediaTypeCommand } from "../../src/commands/StreamingTraitsWithMediaTypeCommand"; import { TestBodyStructureCommand } from "../../src/commands/TestBodyStructureCommand"; +import { TestNoInputNoPayloadCommand } from "../../src/commands/TestNoInputNoPayloadCommand"; import { TestNoPayloadCommand } from "../../src/commands/TestNoPayloadCommand"; import { TestPayloadBlobCommand } from "../../src/commands/TestPayloadBlobCommand"; import { TestPayloadStructureCommand } from "../../src/commands/TestPayloadStructureCommand"; @@ -2335,6 +2338,9 @@ it("RestJsonEnumPayloadRequest:Request", async () => { expect(r.method).toBe("POST"); expect(r.path).toBe("/EnumPayload"); + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("text/plain"); + expect(r.body).toBeDefined(); const utf8Encoder = client.config.utf8Encoder; const bodyString = `enumvalue`; @@ -2346,7 +2352,14 @@ it("RestJsonEnumPayloadRequest:Request", async () => { it("RestJsonEnumPayloadResponse:Response", async () => { const client = new RestJsonProtocolClient({ ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, `enumvalue`), + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/plain", + }, + `enumvalue` + ), }); const params: any = {}; @@ -3367,11 +3380,15 @@ it("RestJsonStringPayloadRequest:Request", async () => { const r = err.request; expect(r.method).toBe("POST"); expect(r.path).toBe("/StringPayload"); + expect(r.headers["content-length"]).toBeDefined(); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("text/plain"); expect(r.body).toBeDefined(); const utf8Encoder = client.config.utf8Encoder; const bodyString = `rawstring`; - const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + const unequalParts: any = compareEquivalentTextBodies(bodyString, r.body); expect(unequalParts).toBeUndefined(); } }); @@ -3379,7 +3396,14 @@ it("RestJsonStringPayloadRequest:Request", async () => { it("RestJsonStringPayloadResponse:Response", async () => { const client = new RestJsonProtocolClient({ ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, `rawstring`), + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/plain", + }, + `rawstring` + ), }); const params: any = {}; @@ -7064,18 +7088,16 @@ it("RestJsonOmitsEmptyListQueryValues:Request", async () => { }); /** - * Unit types in unions are serialized like normal structures in requests. + * Client populates default values in input. */ -it("RestJsonInputUnionWithUnitMember:Request", async () => { +it.skip("RestJsonClientPopulatesDefaultValuesInInput:Request", async () => { const client = new RestJsonProtocolClient({ ...clientParams, requestHandler: new RequestSerializationTestHandler(), }); - const command = new PostPlayerActionCommand({ - action: { - quit: {} as any, - } as any, + const command = new OperationWithDefaultsCommand({ + defaults: {} as any, } as any); try { await client.send(command); @@ -7088,7 +7110,7 @@ it("RestJsonInputUnionWithUnitMember:Request", async () => { } const r = err.request; expect(r.method).toBe("POST"); - expect(r.path).toBe("/PostPlayerAction"); + expect(r.path).toBe("/OperationWithDefaults"); expect(r.headers["content-type"]).toBeDefined(); expect(r.headers["content-type"]).toBe("application/json"); @@ -7096,8 +7118,34 @@ it("RestJsonInputUnionWithUnitMember:Request", async () => { expect(r.body).toBeDefined(); const utf8Encoder = client.config.utf8Encoder; const bodyString = `{ - \"action\": { - \"quit\": {} + \"defaults\": { + \"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()); @@ -7106,61 +7154,110 @@ it("RestJsonInputUnionWithUnitMember:Request", async () => { }); /** - * Unit types in unions are serialized like normal structures in responses. + * Client skips top level default values in input. */ -it("RestJsonOutputUnionWithUnitMember:Response", async () => { +it.skip("RestJsonClientSkipsTopLevelDefaultValuesInInput:Request", async () => { const client = new RestJsonProtocolClient({ ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", - }, - `{ - "action": { - "quit": {} - } - }` - ), + requestHandler: new RequestSerializationTestHandler(), }); - const params: any = {}; - const command = new PostPlayerActionCommand(params); - - let r: any; + const command = new OperationWithDefaultsCommand({} as any); try { - r = await client.send(command); - } catch (err) { - fail("Expected a valid response to be returned, got " + err); + 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("/OperationWithDefaults"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); } - expect(r["$metadata"].httpStatusCode).toBe(200); - const paramsToValidate: any = [ - { - action: { - quit: {}, - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); }); /** - * Tests that jsonName works with union members. + * Client uses explicitly provided member values over defaults */ -it("PostUnionWithJsonNameRequest1:Request", async () => { +it.skip("RestJsonClientUsesExplicitlyProvidedMemberValuesOverDefaults:Request", async () => { const client = new RestJsonProtocolClient({ ...clientParams, requestHandler: new RequestSerializationTestHandler(), }); - const command = new PostUnionWithJsonNameCommand({ - value: { - foo: "hi", + const command = new OperationWithDefaultsCommand({ + defaults: { + defaultString: "bye", + + defaultBoolean: true, + + defaultList: ["a"], + + defaultDocumentMap: { + name: "Jack", + }, + + defaultDocumentString: "bye", + + defaultDocumentBoolean: true, + + defaultDocumentList: ["b"], + + defaultNullDocument: "notNull", + + defaultTimestamp: new Date(1000), + + defaultBlob: Uint8Array.from("hi", (c) => c.charCodeAt(0)), + + defaultByte: 2, + + defaultShort: 2, + + defaultInteger: 20, + + defaultLong: 200, + + defaultFloat: 2.0, + + defaultDouble: 2.0, + + defaultMap: { + name: "Jack", + } as any, + + defaultEnum: "BAR", + + defaultIntEnum: 2, + + emptyString: "foo", + + falseBoolean: true, + + emptyBlob: Uint8Array.from("hi", (c) => c.charCodeAt(0)), + + zeroByte: 1, + + zeroShort: 1, + + zeroInteger: 1, + + zeroLong: 1, + + zeroFloat: 1.0, + + zeroDouble: 1.0, } as any, } as any); try { @@ -7174,7 +7271,7 @@ it("PostUnionWithJsonNameRequest1:Request", async () => { } const r = err.request; expect(r.method).toBe("POST"); - expect(r.path).toBe("/PostUnionWithJsonName"); + expect(r.path).toBe("/OperationWithDefaults"); expect(r.headers["content-type"]).toBeDefined(); expect(r.headers["content-type"]).toBe("application/json"); @@ -7182,8 +7279,35 @@ it("PostUnionWithJsonNameRequest1:Request", async () => { expect(r.body).toBeDefined(); const utf8Encoder = client.config.utf8Encoder; const bodyString = `{ - \"value\": { - \"FOO\": \"hi\" + \"defaults\": { + \"defaultString\": \"bye\", + \"defaultBoolean\": true, + \"defaultList\": [\"a\"], + \"defaultDocumentMap\": {\"name\": \"Jack\"}, + \"defaultDocumentString\": \"bye\", + \"defaultDocumentBoolean\": true, + \"defaultDocumentList\": [\"b\"], + \"defaultNullDocument\": \"notNull\", + \"defaultTimestamp\": 1, + \"defaultBlob\": \"aGk=\", + \"defaultByte\": 2, + \"defaultShort\": 2, + \"defaultInteger\": 20, + \"defaultLong\": 200, + \"defaultFloat\": 2.0, + \"defaultDouble\": 2.0, + \"defaultMap\": {\"name\": \"Jack\"}, + \"defaultEnum\": \"BAR\", + \"defaultIntEnum\": 2, + \"emptyString\": \"foo\", + \"falseBoolean\": true, + \"emptyBlob\": \"aGk=\", + \"zeroByte\": 1, + \"zeroShort\": 1, + \"zeroInteger\": 1, + \"zeroLong\": 1, + \"zeroFloat\": 1.0, + \"zeroDouble\": 1.0 } }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); @@ -7192,18 +7316,18 @@ it("PostUnionWithJsonNameRequest1:Request", async () => { }); /** - * Tests that jsonName works with union members. + * Any time a value is provided for a member in the top level of input, it is used, regardless of if its the default. */ -it("PostUnionWithJsonNameRequest2:Request", async () => { +it.skip("RestJsonClientUsesExplicitlyProvidedValuesInTopLevel:Request", async () => { const client = new RestJsonProtocolClient({ ...clientParams, requestHandler: new RequestSerializationTestHandler(), }); - const command = new PostUnionWithJsonNameCommand({ - value: { - baz: "hi", - } as any, + const command = new OperationWithDefaultsCommand({ + topLevelDefault: "hi", + + otherTopLevelDefault: 0, } as any); try { await client.send(command); @@ -7216,7 +7340,7 @@ it("PostUnionWithJsonNameRequest2:Request", async () => { } const r = err.request; expect(r.method).toBe("POST"); - expect(r.path).toBe("/PostUnionWithJsonName"); + expect(r.path).toBe("/OperationWithDefaults"); expect(r.headers["content-type"]).toBeDefined(); expect(r.headers["content-type"]).toBe("application/json"); @@ -7224,9 +7348,8 @@ it("PostUnionWithJsonNameRequest2:Request", async () => { expect(r.body).toBeDefined(); const utf8Encoder = client.config.utf8Encoder; const bodyString = `{ - \"value\": { - \"_baz\": \"hi\" - } + \"topLevelDefault\": \"hi\", + \"otherTopLevelDefault\": 0 }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); @@ -7234,18 +7357,16 @@ it("PostUnionWithJsonNameRequest2:Request", async () => { }); /** - * Tests that jsonName works with union members. + * Typically, non top-level members would have defaults filled in, but if they have the clientOptional trait, the defaults should be ignored. */ -it("PostUnionWithJsonNameRequest3:Request", async () => { +it.skip("RestJsonClientIgnoresNonTopLevelDefaultsOnMembersWithClientOptional:Request", async () => { const client = new RestJsonProtocolClient({ ...clientParams, requestHandler: new RequestSerializationTestHandler(), }); - const command = new PostUnionWithJsonNameCommand({ - value: { - bar: "hi", - } as any, + const command = new OperationWithDefaultsCommand({ + clientOptionalDefaults: {} as any, } as any); try { await client.send(command); @@ -7258,7 +7379,7 @@ it("PostUnionWithJsonNameRequest3:Request", async () => { } const r = err.request; expect(r.method).toBe("POST"); - expect(r.path).toBe("/PostUnionWithJsonName"); + expect(r.path).toBe("/OperationWithDefaults"); expect(r.headers["content-type"]).toBeDefined(); expect(r.headers["content-type"]).toBe("application/json"); @@ -7266,9 +7387,7 @@ it("PostUnionWithJsonNameRequest3:Request", async () => { expect(r.body).toBeDefined(); const utf8Encoder = client.config.utf8Encoder; const bodyString = `{ - \"value\": { - \"bar\": \"hi\" - } + \"clientOptionalDefaults\": {} }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); @@ -7276,9 +7395,9 @@ it("PostUnionWithJsonNameRequest3:Request", async () => { }); /** - * Tests that jsonName works with union members. + * Client populates default values when missing in response. */ -it("PostUnionWithJsonNameResponse1:Response", async () => { +it.skip("RestJsonClientPopulatesDefaultsValuesWhenMissingInResponse:Response", async () => { const client = new RestJsonProtocolClient({ ...clientParams, requestHandler: new ResponseDeserializationTestHandler( @@ -7287,16 +7406,12 @@ it("PostUnionWithJsonNameResponse1:Response", async () => { { "content-type": "application/json", }, - `{ - "value": { - "FOO": "hi" - } - }` + `{}` ), }); const params: any = {}; - const command = new PostUnionWithJsonNameCommand(params); + const command = new OperationWithDefaultsCommand(params); let r: any; try { @@ -7308,9 +7423,59 @@ it("PostUnionWithJsonNameResponse1:Response", async () => { expect(r["$metadata"].httpStatusCode).toBe(200); const paramsToValidate: any = [ { - value: { - foo: "hi", - }, + defaultString: "hi", + + defaultBoolean: true, + + defaultList: [], + + defaultDocumentMap: {}, + + defaultDocumentString: "hi", + + defaultDocumentBoolean: true, + + defaultDocumentList: [], + + defaultTimestamp: new Date(0 * 1000), + + defaultBlob: Uint8Array.from("abc", (c) => c.charCodeAt(0)), + + defaultByte: 1, + + defaultShort: 1, + + defaultInteger: 10, + + defaultLong: 100, + + defaultFloat: 1.0, + + defaultDouble: 1.0, + + defaultMap: {}, + + defaultEnum: "FOO", + + defaultIntEnum: 1, + + emptyString: "", + + falseBoolean: false, + + emptyBlob: Uint8Array.from("", (c) => c.charCodeAt(0)), + + zeroByte: 0, + + zeroShort: 0, + + zeroInteger: 0, + + zeroLong: 0, + + zeroFloat: 0.0, + + zeroDouble: 0.0, }, ][0]; Object.keys(paramsToValidate).forEach((param) => { @@ -7320,9 +7485,9 @@ it("PostUnionWithJsonNameResponse1:Response", async () => { }); /** - * Tests that jsonName works with union members. + * Client ignores default values if member values are present in the response. */ -it("PostUnionWithJsonNameResponse2:Response", async () => { +it.skip("RestJsonClientIgnoresDefaultValuesIfMemberValuesArePresentInResponse:Response", async () => { const client = new RestJsonProtocolClient({ ...clientParams, requestHandler: new ResponseDeserializationTestHandler( @@ -7332,15 +7497,40 @@ it("PostUnionWithJsonNameResponse2:Response", async () => { "content-type": "application/json", }, `{ - "value": { - "_baz": "hi" - } + "defaultString": "bye", + "defaultBoolean": false, + "defaultList": ["a"], + "defaultDocumentMap": {"name": "Jack"}, + "defaultDocumentString": "bye", + "defaultDocumentBoolean": false, + "defaultDocumentList": ["b"], + "defaultNullDocument": "notNull", + "defaultTimestamp": 2, + "defaultBlob": "aGk=", + "defaultByte": 2, + "defaultShort": 2, + "defaultInteger": 20, + "defaultLong": 200, + "defaultFloat": 2.0, + "defaultDouble": 2.0, + "defaultMap": {"name": "Jack"}, + "defaultEnum": "BAR", + "defaultIntEnum": 2, + "emptyString": "foo", + "falseBoolean": true, + "emptyBlob": "aGk=", + "zeroByte": 1, + "zeroShort": 1, + "zeroInteger": 1, + "zeroLong": 1, + "zeroFloat": 1.0, + "zeroDouble": 1.0 }` ), }); const params: any = {}; - const command = new PostUnionWithJsonNameCommand(params); + const command = new OperationWithDefaultsCommand(params); let r: any; try { @@ -7352,53 +7542,65 @@ it("PostUnionWithJsonNameResponse2:Response", async () => { expect(r["$metadata"].httpStatusCode).toBe(200); const paramsToValidate: any = [ { - value: { - baz: "hi", - }, - }, - ][0]; - Object.keys(paramsToValidate).forEach((param) => { - expect(r[param]).toBeDefined(); - expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); - }); -}); + defaultString: "bye", -/** - * Tests that jsonName works with union members. - */ -it("PostUnionWithJsonNameResponse3:Response", async () => { - const client = new RestJsonProtocolClient({ - ...clientParams, - requestHandler: new ResponseDeserializationTestHandler( - true, - 200, - { - "content-type": "application/json", + defaultBoolean: false, + + defaultList: ["a"], + + defaultDocumentMap: { + name: "Jack", }, - `{ - "value": { - "bar": "hi" - } - }` - ), - }); - const params: any = {}; - const command = new PostUnionWithJsonNameCommand(params); + defaultDocumentString: "bye", - 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 = [ - { - value: { - bar: "hi", + defaultDocumentBoolean: false, + + defaultDocumentList: ["b"], + + defaultNullDocument: "notNull", + + defaultTimestamp: new Date(1 * 1000), + + defaultBlob: Uint8Array.from("hi", (c) => c.charCodeAt(0)), + + defaultByte: 2, + + defaultShort: 2, + + defaultInteger: 20, + + defaultLong: 200, + + defaultFloat: 2.0, + + defaultDouble: 2.0, + + defaultMap: { + name: "Jack", }, + + defaultEnum: "BAR", + + defaultIntEnum: 2, + + emptyString: "foo", + + falseBoolean: true, + + emptyBlob: Uint8Array.from("hi", (c) => c.charCodeAt(0)), + + zeroByte: 1, + + zeroShort: 1, + + zeroInteger: 1, + + zeroLong: 1, + + zeroFloat: 1.0, + + zeroDouble: 1.0, }, ][0]; Object.keys(paramsToValidate).forEach((param) => { @@ -7408,16 +7610,601 @@ it("PostUnionWithJsonNameResponse3:Response", async () => { }); /** - * Compression algorithm encoding is appended to the Content-Encoding header. + * Client populates nested default values when missing. */ -it.skip("SDKAppliedContentEncoding_restJson1:Request", async () => { +it.skip("RestJsonClientPopulatesNestedDefaultValuesWhenMissing:Request", async () => { const client = new RestJsonProtocolClient({ ...clientParams, requestHandler: new RequestSerializationTestHandler(), }); - const command = new PutWithContentEncodingCommand({ - data: "RjCEL3kBwqPivZUXGiyA5JCujtWgJAkKRlnTEsNYfBRGOS0f7LT6R3bCSOXeJ4auSHzQ4BEZZTklUyj5\n1HEojihShQC2jkQJrNdGOZNSW49yRO0XbnGmeczUHbZqZRelLFKW4xjru9uTuB8lFCtwoGgciFsgqTF8\n5HYcoqINTRxuAwGuRUMoNO473QT0BtCQoKUkAyVaypG0hBZdGNoJhunBfW0d3HWTYlzz9pXElyZhq3C1\n2PDB17GEoOYXmTxDecysmPOdo5z6T0HFhujfeJFIQQ8dirmXcG4F3v0bZdf6AZ3jsiVh6RnEXIPxPbOi\ngIXDWTMUr4Pg3f2LdYCM01eAb2qTdgsEN0MUDhEIfn68I2tnWvcozyUFpg1ez6pyWP8ssWVfFrckREIM\nMb0cTUVqSVSM8bnFiF9SoXM6ZoGMKfX1mT708OYk7SqZ1JlCTkecDJDoR5ED2q2MWKUGR6jjnEV0GtD8\nWJO6AcF0DptY9Hk16Bav3z6c5FeBvrGDrxTFVgRUk8SychzjrcqJ4qskwN8rL3zslC0oqobQRnLFOvwJ\nprSzBIwdH2yAuxokXAdVRa1u9NGNRvfWJfKkwbbVz8yV76RUF9KNhAUmwyYDrLnxNj8ROl8B7dv8Gans\n7Bit52wcdiJyjBW1pAodB7zqqVwtBx5RaSpF7kEMXexYXp9N0J1jlXzdeg5Wgg4pO7TJNr2joiPVAiFf\nefwMMCNBkYx2z7cRxVxCJZMXXzxSKMGgdTN24bJ5UgE0TxyV52RC0wGWG49S1x5jGrvmxKCIgYPs0w3Z\n0I3XcdB0WEj4x4xRztB9Cx2Mc4qFYQdzS9kOioAgNBti1rBySZ8lFZM2zqxvBsJTTJsmcKPr1crqiXjM\noVWdM4ObOO6QA7Pu4c1hT68CrTmbcecjFcxHkgsqdixnFtN6keMGL9Z2YMjZOjYYzbUEwLJqUVWalkIB\nBkgBR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fXurzDybX468aoRoks654jjmRY5zi1oB8TcMdC2c3sicNaqfeuhd\nH1nPX7l4RpdqWMR7gGx9slXtG8S3KxpOi4qCD7yg3saD66nun4dzksQURoTUdXyrJR5UpHsfIlTF1aJa\nMdXyQtQnrkl00TeghQd00rRFZsCnhi0qrCSKiBfB2EVrd9RPpbgwJGZHuIQecdBmNetc2ylSEClqVBPR\nGOPPIxrnswEZjmnS0jxKW9VSM1QVxSPJnPFswCqT95SoKD6CP4xdX28WIUGiNaIKodXXJHEIsXBCxLsr\nPwWPCtoplC6hhpKmW5dQo92iCTyY2KioKzO8XR6FKm6qonMKVEwQNtlYE9c97KMtEnp25VOdMP46SQXS\nYsSVp7vm8LP87VYI8SOKcW3s2oedYFtt45rvDzoTF0GmS6wELQ9uo98HhjQAI1Dt91cgjJOwygNmLoZE\nX5K2zQiNA163uMCl5xzaBqY4YTL0wgALg3IFdYSp0RFYLWdt6IxoGI1tnoxcjlUEPo5eGIc3mS3SmaLn\nOdumfUQQ4Jgmgaa5anUVQsfBDrlAN5oaX7O0JO71SSPSWiHBsT9WIPy2J1Cace9ZZLRxblFPSXcvsuHh\nhvnhWQltEDAe7MgvkFQ8lGVFa8jhzijoF9kLmMhMILSzYnfXnZPNP7TlAAwlLHK1RqlpHskJqb6CPpGP\nQvOAhEMsM3zJ2KejZx0esxkjxA0ZufVvGAMN3vTUMplQaF4RiQkp9fzBXf3CMk01dWjOMMIEXTeKzIQe\nEcffzjixWU9FpAyGp2rVl4ETRgqljOGw4UgK31r0ZIEGnH0xGz1FtbW1OcQM008JVujRqulCucEMmntr\n", + const command = new OperationWithNestedStructureCommand({ + topLevel: { + dialog: { + language: "en", + } as any, + + dialogList: [ + {} as any, + + { + farewell: {} as any, + } as any, + + { + language: "it", + + greeting: "ciao", + + farewell: { + phrase: "arrivederci", + } as any, + } as any, + ], + + dialogMap: { + emptyDialog: {} as any, + + partialEmptyDialog: { + language: "en", + + farewell: {} as any, + } as any, + + nonEmptyDialog: { + greeting: "konnichiwa", + + farewell: { + phrase: "sayonara", + } as any, + } as any, + } as any, + } as any, + } 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("/OperationWithNestedStructure"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"topLevel\": { + \"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(); + } +}); + +/** + * Client populates nested default values when missing in response body. + */ +it.skip("RestJsonClientPopulatesNestedDefaultsWhenMissingInResponseBody:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "dialog": { + "language": "en" + }, + "dialogList": [ + { + }, + { + "farewell": {} + }, + { + "language": "it", + "greeting": "ciao", + "farewell": { + "phrase": "arrivederci" + } + } + ], + "dialogMap": { + "emptyDialog": { + }, + "partialEmptyDialog": { + "language": "en", + "farewell": {} + }, + "nonEmptyDialog": { + "greeting": "konnichiwa", + "farewell": { + "phrase": "sayonara" + } + } + } + }` + ), + }); + + const params: any = {}; + const command = new OperationWithNestedStructureCommand(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 = [ + { + 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", + }, + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Unit types in unions are serialized like normal structures in requests. + */ +it("RestJsonInputUnionWithUnitMember:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new PostPlayerActionCommand({ + action: { + quit: {} as any, + } as any, + } 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("/PostPlayerAction"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"action\": { + \"quit\": {} + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Unit types in unions are serialized like normal structures in responses. + */ +it("RestJsonOutputUnionWithUnitMember:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "action": { + "quit": {} + } + }` + ), + }); + + const params: any = {}; + const command = new PostPlayerActionCommand(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 = [ + { + action: { + quit: {}, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests that jsonName works with union members. + */ +it("PostUnionWithJsonNameRequest1:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new PostUnionWithJsonNameCommand({ + value: { + foo: "hi", + } as any, + } 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("/PostUnionWithJsonName"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"value\": { + \"FOO\": \"hi\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Tests that jsonName works with union members. + */ +it("PostUnionWithJsonNameRequest2:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new PostUnionWithJsonNameCommand({ + value: { + baz: "hi", + } as any, + } 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("/PostUnionWithJsonName"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"value\": { + \"_baz\": \"hi\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Tests that jsonName works with union members. + */ +it("PostUnionWithJsonNameRequest3:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new PostUnionWithJsonNameCommand({ + value: { + bar: "hi", + } as any, + } 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("/PostUnionWithJsonName"); + + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).toBeDefined(); + const utf8Encoder = client.config.utf8Encoder; + const bodyString = `{ + \"value\": { + \"bar\": \"hi\" + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); + } +}); + +/** + * Tests that jsonName works with union members. + */ +it("PostUnionWithJsonNameResponse1:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "value": { + "FOO": "hi" + } + }` + ), + }); + + const params: any = {}; + const command = new PostUnionWithJsonNameCommand(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 = [ + { + value: { + foo: "hi", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests that jsonName works with union members. + */ +it("PostUnionWithJsonNameResponse2:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "value": { + "_baz": "hi" + } + }` + ), + }); + + const params: any = {}; + const command = new PostUnionWithJsonNameCommand(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 = [ + { + value: { + baz: "hi", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Tests that jsonName works with union members. + */ +it("PostUnionWithJsonNameResponse3:Response", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "application/json", + }, + `{ + "value": { + "bar": "hi" + } + }` + ), + }); + + const params: any = {}; + const command = new PostUnionWithJsonNameCommand(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 = [ + { + value: { + bar: "hi", + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Compression algorithm encoding is appended to the Content-Encoding header. + */ +it.skip("SDKAppliedContentEncoding_restJson1:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new PutWithContentEncodingCommand({ + data: "RjCEL3kBwqPivZUXGiyA5JCujtWgJAkKRlnTEsNYfBRGOS0f7LT6R3bCSOXeJ4auSHzQ4BEZZTklUyj5\n1HEojihShQC2jkQJrNdGOZNSW49yRO0XbnGmeczUHbZqZRelLFKW4xjru9uTuB8lFCtwoGgciFsgqTF8\n5HYcoqINTRxuAwGuRUMoNO473QT0BtCQoKUkAyVaypG0hBZdGNoJhunBfW0d3HWTYlzz9pXElyZhq3C1\n2PDB17GEoOYXmTxDecysmPOdo5z6T0HFhujfeJFIQQ8dirmXcG4F3v0bZdf6AZ3jsiVh6RnEXIPxPbOi\ngIXDWTMUr4Pg3f2LdYCM01eAb2qTdgsEN0MUDhEIfn68I2tnWvcozyUFpg1ez6pyWP8ssWVfFrckREIM\nMb0cTUVqSVSM8bnFiF9SoXM6ZoGMKfX1mT708OYk7SqZ1JlCTkecDJDoR5ED2q2MWKUGR6jjnEV0GtD8\nWJO6AcF0DptY9Hk16Bav3z6c5FeBvrGDrxTFVgRUk8SychzjrcqJ4qskwN8rL3zslC0oqobQRnLFOvwJ\nprSzBIwdH2yAuxokXAdVRa1u9NGNRvfWJfKkwbbVz8yV76RUF9KNhAUmwyYDrLnxNj8ROl8B7dv8Gans\n7Bit52wcdiJyjBW1pAodB7zqqVwtBx5RaSpF7kEMXexYXp9N0J1jlXzdeg5Wgg4pO7TJNr2joiPVAiFf\nefwMMCNBkYx2z7cRxVxCJZMXXzxSKMGgdTN24bJ5UgE0TxyV52RC0wGWG49S1x5jGrvmxKCIgYPs0w3Z\n0I3XcdB0WEj4x4xRztB9Cx2Mc4qFYQdzS9kOioAgNBti1rBySZ8lFZM2zqxvBsJTTJsmcKPr1crqiXjM\noVWdM4ObOO6QA7Pu4c1hT68CrTmbcecjFcxHkgsqdixnFtN6keMGL9Z2YMjZOjYYzbUEwLJqUVWalkIB\nBkgBR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fXurzDybX468aoRoks654jjmRY5zi1oB8TcMdC2c3sicNaqfeuhd\nH1nPX7l4RpdqWMR7gGx9slXtG8S3KxpOi4qCD7yg3saD66nun4dzksQURoTUdXyrJR5UpHsfIlTF1aJa\nMdXyQtQnrkl00TeghQd00rRFZsCnhi0qrCSKiBfB2EVrd9RPpbgwJGZHuIQecdBmNetc2ylSEClqVBPR\nGOPPIxrnswEZjmnS0jxKW9VSM1QVxSPJnPFswCqT95SoKD6CP4xdX28WIUGiNaIKodXXJHEIsXBCxLsr\nPwWPCtoplC6hhpKmW5dQo92iCTyY2KioKzO8XR6FKm6qonMKVEwQNtlYE9c97KMtEnp25VOdMP46SQXS\nYsSVp7vm8LP87VYI8SOKcW3s2oedYFtt45rvDzoTF0GmS6wELQ9uo98HhjQAI1Dt91cgjJOwygNmLoZE\nX5K2zQiNA163uMCl5xzaBqY4YTL0wgALg3IFdYSp0RFYLWdt6IxoGI1tnoxcjlUEPo5eGIc3mS3SmaLn\nOdumfUQQ4Jgmgaa5anUVQsfBDrlAN5oaX7O0JO71SSPSWiHBsT9WIPy2J1Cace9ZZLRxblFPSXcvsuHh\nhvnhWQltEDAe7MgvkFQ8lGVFa8jhzijoF9kLmMhMILSzYnfXnZPNP7TlAAwlLHK1RqlpHskJqb6CPpGP\nQvOAhEMsM3zJ2KejZx0esxkjxA0ZufVvGAMN3vTUMplQaF4RiQkp9fzBXf3CMk01dWjOMMIEXTeKzIQe\nEcffzjixWU9FpAyGp2rVl4ETRgqljOGw4UgK31r0ZIEGnH0xGz1FtbW1OcQM008JVujRqulCucEMmntr\n", } as any); try { await client.send(command); @@ -9199,6 +9986,36 @@ it("RestJsonHttpWithEmptyBody:Request", async () => { } }); +/** + * Serializes a GET request for an operation with no input, and therefore no modeled body + */ +it("RestJsonHttpWithNoInput:Request", async () => { + const client = new RestJsonProtocolClient({ + ...clientParams, + requestHandler: new RequestSerializationTestHandler(), + }); + + const command = new TestNoInputNoPayloadCommand({}); + 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("GET"); + expect(r.path).toBe("/no_input_no_payload"); + + expect(r.headers["content-length"]).toBeUndefined(); + expect(r.headers["content-type"]).toBeUndefined(); + + expect(r.body).toBeFalsy(); + } +}); + /** * Serializes a GET request with no modeled body */ @@ -9633,6 +10450,17 @@ const compareEquivalentOctetStreamBodies = ( return compareParts(expectedParts, generatedParts); }; +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentTextBodies = (expectedBody: string, generatedBody: string): Object => { + const expectedParts = { Value: expectedBody }; + const generatedParts = { Value: generatedBody }; + + return compareParts(expectedParts, generatedParts); +}; + /** * Returns a map of key names that were un-equal to value objects showing the * discrepancies between the components. diff --git a/private/aws-protocoltests-restxml/README.md b/private/aws-protocoltests-restxml/README.md index 8aa18ce3a19a..999259370862 100644 --- a/private/aws-protocoltests-restxml/README.md +++ b/private/aws-protocoltests-restxml/README.md @@ -402,6 +402,14 @@ XmlTimestamps [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/XmlTimestampsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/XmlTimestampsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/XmlTimestampsCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -538,6 +546,14 @@ SparseNullsOperation [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/SparseNullsOperationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/SparseNullsOperationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/SparseNullsOperationCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -946,6 +962,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ContentTypeParametersCommandOutput/) +
@@ -1538,6 +1562,22 @@ OmitsSerializingEmptyLists [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/OmitsSerializingEmptyListsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/OmitsSerializingEmptyListsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/OmitsSerializingEmptyListsCommandOutput/) +
+
+ +OperationWithDefaults + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/OperationWithDefaultsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/OperationWithDefaultsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/OperationWithDefaultsCommandOutput/) + +
+
+ +OperationWithNestedStructure + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/OperationWithNestedStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/OperationWithNestedStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/OperationWithNestedStructureCommandOutput/) +
@@ -1666,6 +1706,14 @@ TestBodyStructure [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/TestBodyStructureCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/TestBodyStructureCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/TestBodyStructureCommandOutput/) +
+
+ +TestNoInputNoPayload + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/TestNoInputNoPayloadCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/TestNoInputNoPayloadCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/TestNoInputNoPayloadCommandOutput/) +
@@ -1834,6 +1882,14 @@ ConstantQueryString [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/ConstantQueryStringCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ConstantQueryStringCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ConstantQueryStringCommandOutput/) +
+
+ +ContentTypeParameters + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/rest-xml-protocol/command/ContentTypeParametersCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ContentTypeParametersCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-rest-xml-protocol/Interface/ContentTypeParametersCommandOutput/) +
diff --git a/private/aws-protocoltests-restxml/src/RestXmlProtocol.ts b/private/aws-protocoltests-restxml/src/RestXmlProtocol.ts index b396532b4157..8e436685f107 100644 --- a/private/aws-protocoltests-restxml/src/RestXmlProtocol.ts +++ b/private/aws-protocoltests-restxml/src/RestXmlProtocol.ts @@ -22,6 +22,11 @@ import { ConstantQueryStringCommandInput, ConstantQueryStringCommandOutput, } from "./commands/ConstantQueryStringCommand"; +import { + ContentTypeParametersCommand, + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "./commands/ContentTypeParametersCommand"; import { DatetimeOffsetsCommand, DatetimeOffsetsCommandInput, @@ -290,6 +295,7 @@ const commands = { BodyWithXmlNameCommand, ConstantAndVariableQueryStringCommand, ConstantQueryStringCommand, + ContentTypeParametersCommand, DatetimeOffsetsCommand, EmptyInputAndEmptyOutputCommand, EndpointOperationCommand, @@ -418,6 +424,24 @@ export interface RestXmlProtocol { cb: (err: any, data?: ConstantQueryStringCommandOutput) => void ): void; + /** + * @see {@link ContentTypeParametersCommand} + */ + contentTypeParameters(): Promise; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + options?: __HttpHandlerOptions + ): Promise; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + cb: (err: any, data?: ContentTypeParametersCommandOutput) => void + ): void; + contentTypeParameters( + args: ContentTypeParametersCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ContentTypeParametersCommandOutput) => void + ): void; + /** * @see {@link DatetimeOffsetsCommand} */ diff --git a/private/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts b/private/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts index ddeb1e39a04c..cb7298a2f1a3 100644 --- a/private/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts +++ b/private/aws-protocoltests-restxml/src/RestXmlProtocolClient.ts @@ -73,6 +73,10 @@ import { ConstantQueryStringCommandInput, ConstantQueryStringCommandOutput, } from "./commands/ConstantQueryStringCommand"; +import { + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "./commands/ContentTypeParametersCommand"; import { DatetimeOffsetsCommandInput, DatetimeOffsetsCommandOutput } from "./commands/DatetimeOffsetsCommand"; import { EmptyInputAndEmptyOutputCommandInput, @@ -227,6 +231,7 @@ export type ServiceInputTypes = | BodyWithXmlNameCommandInput | ConstantAndVariableQueryStringCommandInput | ConstantQueryStringCommandInput + | ContentTypeParametersCommandInput | DatetimeOffsetsCommandInput | EmptyInputAndEmptyOutputCommandInput | EndpointOperationCommandInput @@ -293,6 +298,7 @@ export type ServiceOutputTypes = | BodyWithXmlNameCommandOutput | ConstantAndVariableQueryStringCommandOutput | ConstantQueryStringCommandOutput + | ContentTypeParametersCommandOutput | DatetimeOffsetsCommandOutput | EmptyInputAndEmptyOutputCommandOutput | EndpointOperationCommandOutput diff --git a/private/aws-protocoltests-restxml/src/commands/ContentTypeParametersCommand.ts b/private/aws-protocoltests-restxml/src/commands/ContentTypeParametersCommand.ts new file mode 100644 index 000000000000..dd9826afd5f7 --- /dev/null +++ b/private/aws-protocoltests-restxml/src/commands/ContentTypeParametersCommand.ts @@ -0,0 +1,73 @@ +// smithy-typescript generated code +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { ContentTypeParametersInput, ContentTypeParametersOutput } from "../models/models_0"; +import { de_ContentTypeParametersCommand, se_ContentTypeParametersCommand } from "../protocols/Aws_restXml"; +import { RestXmlProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestXmlProtocolClient"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link ContentTypeParametersCommand}. + */ +export interface ContentTypeParametersCommandInput extends ContentTypeParametersInput {} +/** + * @public + * + * The output of {@link ContentTypeParametersCommand}. + */ +export interface ContentTypeParametersCommandOutput extends ContentTypeParametersOutput, __MetadataBearer {} + +/** + * The example tests how servers must support requests + * containing a `Content-Type` header with parameters. + * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { RestXmlProtocolClient, ContentTypeParametersCommand } from "@aws-sdk/aws-protocoltests-restxml"; // ES Modules import + * // const { RestXmlProtocolClient, ContentTypeParametersCommand } = require("@aws-sdk/aws-protocoltests-restxml"); // CommonJS import + * const client = new RestXmlProtocolClient(config); + * const input = { // ContentTypeParametersInput + * value: Number("int"), + * }; + * const command = new ContentTypeParametersCommand(input); + * const response = await client.send(command); + * // {}; + * + * ``` + * + * @param ContentTypeParametersCommandInput - {@link ContentTypeParametersCommandInput} + * @returns {@link ContentTypeParametersCommandOutput} + * @see {@link ContentTypeParametersCommandInput} for command's `input` shape. + * @see {@link ContentTypeParametersCommandOutput} for command's `response` shape. + * @see {@link RestXmlProtocolClientResolvedConfig | config} for RestXmlProtocolClient's `config` shape. + * + * @throws {@link RestXmlProtocolServiceException} + *

Base exception class for all service exceptions from RestXmlProtocol service.

+ * + * @public + */ +export class ContentTypeParametersCommand extends $Command + .classBuilder< + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, + RestXmlProtocolClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .m(function (this: any, Command: any, cs: any, config: RestXmlProtocolClientResolvedConfig, o: any) { + return [getSerdePlugin(config, this.serialize, this.deserialize)]; + }) + .s("RestXml", "ContentTypeParameters", {}) + .n("RestXmlProtocolClient", "ContentTypeParametersCommand") + .f(void 0, void 0) + .ser(se_ContentTypeParametersCommand) + .de(de_ContentTypeParametersCommand) + .build() {} diff --git a/private/aws-protocoltests-restxml/src/commands/index.ts b/private/aws-protocoltests-restxml/src/commands/index.ts index 1a72b70659c5..a8393aaf5f38 100644 --- a/private/aws-protocoltests-restxml/src/commands/index.ts +++ b/private/aws-protocoltests-restxml/src/commands/index.ts @@ -3,6 +3,7 @@ export * from "./AllQueryStringTypesCommand"; export * from "./BodyWithXmlNameCommand"; export * from "./ConstantAndVariableQueryStringCommand"; export * from "./ConstantQueryStringCommand"; +export * from "./ContentTypeParametersCommand"; export * from "./DatetimeOffsetsCommand"; export * from "./EmptyInputAndEmptyOutputCommand"; export * from "./EndpointOperationCommand"; diff --git a/private/aws-protocoltests-restxml/src/models/models_0.ts b/private/aws-protocoltests-restxml/src/models/models_0.ts index d2e7c91e483c..276714c08d18 100644 --- a/private/aws-protocoltests-restxml/src/models/models_0.ts +++ b/private/aws-protocoltests-restxml/src/models/models_0.ts @@ -121,6 +121,18 @@ export interface ConstantQueryStringInput { hello: string | undefined; } +/** + * @public + */ +export interface ContentTypeParametersInput { + value?: number; +} + +/** + * @public + */ +export interface ContentTypeParametersOutput {} + /** * @public */ diff --git a/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts b/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts index e8cd612ece48..84a3fef6ccc2 100644 --- a/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts +++ b/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts @@ -54,6 +54,10 @@ import { ConstantQueryStringCommandInput, ConstantQueryStringCommandOutput, } from "../commands/ConstantQueryStringCommand"; +import { + ContentTypeParametersCommandInput, + ContentTypeParametersCommandOutput, +} from "../commands/ContentTypeParametersCommand"; import { DatetimeOffsetsCommandInput, DatetimeOffsetsCommandOutput } from "../commands/DatetimeOffsetsCommand"; import { EmptyInputAndEmptyOutputCommandInput, @@ -343,6 +347,29 @@ export const se_ConstantQueryStringCommand = async ( return b.build(); }; +/** + * serializeAws_restXmlContentTypeParametersCommand + */ +export const se_ContentTypeParametersCommand = async ( + input: ContentTypeParametersCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/xml", + }; + b.bp("/ContentTypeParameters"); + let body: any; + body = _ve; + const bn = new __XmlNode(_CTPI); + if (input[_v] != null) { + bn.c(__XmlNode.of(_I, String(input[_v])).n(_v)); + } + body += bn.toString(); + b.m("PUT").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restXmlDatetimeOffsetsCommand */ @@ -1775,6 +1802,23 @@ export const de_ConstantQueryStringCommand = async ( return contents; }; +/** + * deserializeAws_restXmlContentTypeParametersCommand + */ +export const de_ContentTypeParametersCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + await collectBody(output.body, context); + return contents; +}; + /** * deserializeAws_restXmlDatetimeOffsetsCommand */ @@ -4344,6 +4388,7 @@ const _B = "Byte"; const _BL = "BooleanList"; const _Bl = "Blob"; const _Bo = "Boolean"; +const _CTPI = "ContentTypeParametersInput"; const _D = "Double"; const _DD = "DoubleDribble"; const _DL = "DoubleList"; diff --git a/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts b/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts index 0ad931b3f8fb..b3fa2318c642 100644 --- a/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts +++ b/private/aws-protocoltests-restxml/test/functional/restxml.spec.ts @@ -1440,6 +1440,9 @@ it("RestXmlEnumPayloadRequest:Request", async () => { expect(r.method).toBe("POST"); expect(r.path).toBe("/EnumPayload"); + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("text/plain"); + expect(r.body).toBeDefined(); const utf8Encoder = client.config.utf8Encoder; const bodyString = `enumvalue`; @@ -1451,7 +1454,14 @@ it("RestXmlEnumPayloadRequest:Request", async () => { it("RestXmlEnumPayloadResponse:Response", async () => { const client = new RestXmlProtocolClient({ ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, `enumvalue`), + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/plain", + }, + `enumvalue` + ), }); const params: any = {}; @@ -2738,6 +2748,9 @@ it("RestXmlStringPayloadRequest:Request", async () => { expect(r.method).toBe("POST"); expect(r.path).toBe("/StringPayload"); + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("text/plain"); + expect(r.body).toBeDefined(); const utf8Encoder = client.config.utf8Encoder; const bodyString = `rawstring`; @@ -2749,7 +2762,14 @@ it("RestXmlStringPayloadRequest:Request", async () => { it("RestXmlStringPayloadResponse:Response", async () => { const client = new RestXmlProtocolClient({ ...clientParams, - requestHandler: new ResponseDeserializationTestHandler(true, 200, undefined, `rawstring`), + requestHandler: new ResponseDeserializationTestHandler( + true, + 200, + { + "content-type": "text/plain", + }, + `rawstring` + ), }); const params: any = {}; diff --git a/private/aws-restjson-server/src/models/models_0.ts b/private/aws-restjson-server/src/models/models_0.ts index 1f366bbd4c87..c058c9517d2c 100644 --- a/private/aws-restjson-server/src/models/models_0.ts +++ b/private/aws-restjson-server/src/models/models_0.ts @@ -288,6 +288,38 @@ export namespace AllQueryStringTypesInput { }; } +/** + * @public + */ +export interface ClientOptionalDefaults { + member?: number; +} + +export namespace ClientOptionalDefaults { + const memberValidators: { + member?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: ClientOptionalDefaults, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "member": { + memberValidators["member"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("member").validate(obj.member, `${path}/member`)]; + }; +} + /** * @public */ @@ -416,6 +448,62 @@ export namespace ConstantQueryStringInput { }; } +/** + * @public + */ +export interface ContentTypeParametersInput { + value?: number; +} + +export namespace ContentTypeParametersInput { + const memberValidators: { + value?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: ContentTypeParametersInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "value": { + memberValidators["value"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("value").validate(obj.value, `${path}/value`)]; + }; +} + +/** + * @public + */ +export interface ContentTypeParametersOutput {} + +export namespace ContentTypeParametersOutput { + const memberValidators: {} = {}; + /** + * @internal + */ + export const validate = (obj: ContentTypeParametersOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + } + } + return memberValidators[member]!; + } + return []; + }; +} + /** * @public */ @@ -448,6 +536,346 @@ export namespace DatetimeOffsetsOutput { }; } +/** + * @public + * @enum + */ +export const TestEnum = { + BAR: "BAR", + BAZ: "BAZ", + FOO: "FOO", +} as const; +/** + * @public + */ +export type TestEnum = (typeof TestEnum)[keyof typeof TestEnum]; + +export enum TestIntEnum { + ONE = 1, + TWO = 2, +} + +/** + * @public + */ +export interface Defaults { + defaultString?: string; + defaultBoolean?: boolean; + defaultList?: string[]; + defaultDocumentMap?: __DocumentType; + defaultDocumentString?: __DocumentType; + defaultDocumentBoolean?: __DocumentType; + defaultDocumentList?: __DocumentType; + defaultNullDocument?: __DocumentType; + defaultTimestamp?: Date; + defaultBlob?: Uint8Array; + defaultByte?: number; + defaultShort?: number; + defaultInteger?: number; + defaultLong?: number; + defaultFloat?: number; + defaultDouble?: number; + defaultMap?: Record; + defaultEnum?: TestEnum; + defaultIntEnum?: TestIntEnum; + emptyString?: string; + falseBoolean?: boolean; + emptyBlob?: Uint8Array; + zeroByte?: number; + zeroShort?: number; + zeroInteger?: number; + zeroLong?: number; + zeroFloat?: number; + zeroDouble?: number; +} + +export namespace Defaults { + const memberValidators: { + defaultString?: __MultiConstraintValidator; + defaultBoolean?: __MultiConstraintValidator; + defaultList?: __MultiConstraintValidator>; + defaultDocumentMap?: __MultiConstraintValidator<__DocumentType>; + defaultDocumentString?: __MultiConstraintValidator<__DocumentType>; + defaultDocumentBoolean?: __MultiConstraintValidator<__DocumentType>; + defaultDocumentList?: __MultiConstraintValidator<__DocumentType>; + defaultNullDocument?: __MultiConstraintValidator<__DocumentType>; + defaultTimestamp?: __MultiConstraintValidator; + defaultBlob?: __MultiConstraintValidator; + defaultByte?: __MultiConstraintValidator; + defaultShort?: __MultiConstraintValidator; + defaultInteger?: __MultiConstraintValidator; + defaultLong?: __MultiConstraintValidator; + defaultFloat?: __MultiConstraintValidator; + defaultDouble?: __MultiConstraintValidator; + defaultMap?: __MultiConstraintValidator>; + defaultEnum?: __MultiConstraintValidator; + defaultIntEnum?: __MultiConstraintValidator; + emptyString?: __MultiConstraintValidator; + falseBoolean?: __MultiConstraintValidator; + emptyBlob?: __MultiConstraintValidator; + zeroByte?: __MultiConstraintValidator; + zeroShort?: __MultiConstraintValidator; + zeroInteger?: __MultiConstraintValidator; + zeroLong?: __MultiConstraintValidator; + zeroFloat?: __MultiConstraintValidator; + zeroDouble?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: Defaults, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "defaultString": { + memberValidators["defaultString"] = new __NoOpValidator(); + break; + } + case "defaultBoolean": { + memberValidators["defaultBoolean"] = new __NoOpValidator(); + break; + } + case "defaultList": { + memberValidators["defaultList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "defaultDocumentMap": { + memberValidators["defaultDocumentMap"] = new __NoOpValidator(); + break; + } + case "defaultDocumentString": { + memberValidators["defaultDocumentString"] = new __NoOpValidator(); + break; + } + case "defaultDocumentBoolean": { + memberValidators["defaultDocumentBoolean"] = new __NoOpValidator(); + break; + } + case "defaultDocumentList": { + memberValidators["defaultDocumentList"] = new __NoOpValidator(); + break; + } + case "defaultNullDocument": { + memberValidators["defaultNullDocument"] = new __NoOpValidator(); + break; + } + case "defaultTimestamp": { + memberValidators["defaultTimestamp"] = new __NoOpValidator(); + break; + } + case "defaultBlob": { + memberValidators["defaultBlob"] = new __NoOpValidator(); + break; + } + case "defaultByte": { + memberValidators["defaultByte"] = new __NoOpValidator(); + break; + } + case "defaultShort": { + memberValidators["defaultShort"] = new __NoOpValidator(); + break; + } + case "defaultInteger": { + memberValidators["defaultInteger"] = new __NoOpValidator(); + break; + } + case "defaultLong": { + memberValidators["defaultLong"] = new __NoOpValidator(); + break; + } + case "defaultFloat": { + memberValidators["defaultFloat"] = new __NoOpValidator(); + break; + } + case "defaultDouble": { + memberValidators["defaultDouble"] = new __NoOpValidator(); + break; + } + case "defaultMap": { + memberValidators["defaultMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "defaultEnum": { + memberValidators["defaultEnum"] = new __CompositeValidator([ + new __EnumValidator(["FOO", "BAR", "BAZ"], ["FOO", "BAR", "BAZ"]), + ]); + break; + } + case "defaultIntEnum": { + memberValidators["defaultIntEnum"] = new __CompositeValidator([new __IntegerEnumValidator([1, 2])]); + break; + } + case "emptyString": { + memberValidators["emptyString"] = new __NoOpValidator(); + break; + } + case "falseBoolean": { + memberValidators["falseBoolean"] = new __NoOpValidator(); + break; + } + case "emptyBlob": { + memberValidators["emptyBlob"] = new __NoOpValidator(); + break; + } + case "zeroByte": { + memberValidators["zeroByte"] = new __NoOpValidator(); + break; + } + case "zeroShort": { + memberValidators["zeroShort"] = new __NoOpValidator(); + break; + } + case "zeroInteger": { + memberValidators["zeroInteger"] = new __NoOpValidator(); + break; + } + case "zeroLong": { + memberValidators["zeroLong"] = new __NoOpValidator(); + break; + } + case "zeroFloat": { + memberValidators["zeroFloat"] = new __NoOpValidator(); + break; + } + case "zeroDouble": { + memberValidators["zeroDouble"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("defaultString").validate(obj.defaultString, `${path}/defaultString`), + ...getMemberValidator("defaultBoolean").validate(obj.defaultBoolean, `${path}/defaultBoolean`), + ...getMemberValidator("defaultList").validate(obj.defaultList, `${path}/defaultList`), + ...getMemberValidator("defaultDocumentMap").validate(obj.defaultDocumentMap, `${path}/defaultDocumentMap`), + ...getMemberValidator("defaultDocumentString").validate( + obj.defaultDocumentString, + `${path}/defaultDocumentString` + ), + ...getMemberValidator("defaultDocumentBoolean").validate( + obj.defaultDocumentBoolean, + `${path}/defaultDocumentBoolean` + ), + ...getMemberValidator("defaultDocumentList").validate(obj.defaultDocumentList, `${path}/defaultDocumentList`), + ...getMemberValidator("defaultNullDocument").validate(obj.defaultNullDocument, `${path}/defaultNullDocument`), + ...getMemberValidator("defaultTimestamp").validate(obj.defaultTimestamp, `${path}/defaultTimestamp`), + ...getMemberValidator("defaultBlob").validate(obj.defaultBlob, `${path}/defaultBlob`), + ...getMemberValidator("defaultByte").validate(obj.defaultByte, `${path}/defaultByte`), + ...getMemberValidator("defaultShort").validate(obj.defaultShort, `${path}/defaultShort`), + ...getMemberValidator("defaultInteger").validate(obj.defaultInteger, `${path}/defaultInteger`), + ...getMemberValidator("defaultLong").validate(obj.defaultLong, `${path}/defaultLong`), + ...getMemberValidator("defaultFloat").validate(obj.defaultFloat, `${path}/defaultFloat`), + ...getMemberValidator("defaultDouble").validate(obj.defaultDouble, `${path}/defaultDouble`), + ...getMemberValidator("defaultMap").validate(obj.defaultMap, `${path}/defaultMap`), + ...getMemberValidator("defaultEnum").validate(obj.defaultEnum, `${path}/defaultEnum`), + ...getMemberValidator("defaultIntEnum").validate(obj.defaultIntEnum, `${path}/defaultIntEnum`), + ...getMemberValidator("emptyString").validate(obj.emptyString, `${path}/emptyString`), + ...getMemberValidator("falseBoolean").validate(obj.falseBoolean, `${path}/falseBoolean`), + ...getMemberValidator("emptyBlob").validate(obj.emptyBlob, `${path}/emptyBlob`), + ...getMemberValidator("zeroByte").validate(obj.zeroByte, `${path}/zeroByte`), + ...getMemberValidator("zeroShort").validate(obj.zeroShort, `${path}/zeroShort`), + ...getMemberValidator("zeroInteger").validate(obj.zeroInteger, `${path}/zeroInteger`), + ...getMemberValidator("zeroLong").validate(obj.zeroLong, `${path}/zeroLong`), + ...getMemberValidator("zeroFloat").validate(obj.zeroFloat, `${path}/zeroFloat`), + ...getMemberValidator("zeroDouble").validate(obj.zeroDouble, `${path}/zeroDouble`), + ]; + }; +} + +/** + * @public + */ +export interface Farewell { + phrase?: string; +} + +export namespace Farewell { + const memberValidators: { + phrase?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: Farewell, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "phrase": { + memberValidators["phrase"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("phrase").validate(obj.phrase, `${path}/phrase`)]; + }; +} + +/** + * @public + */ +export interface Dialog { + language?: string; + greeting?: string; + farewell?: Farewell; +} + +export namespace Dialog { + const memberValidators: { + language?: __MultiConstraintValidator; + greeting?: __MultiConstraintValidator; + farewell?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: Dialog, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "language": { + memberValidators["language"] = new __NoOpValidator(); + break; + } + case "greeting": { + memberValidators["greeting"] = new __NoOpValidator(); + break; + } + case "farewell": { + memberValidators["farewell"] = new __CompositeStructureValidator( + new __NoOpValidator(), + Farewell.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("language").validate(obj.language, `${path}/language`), + ...getMemberValidator("greeting").validate(obj.greeting, `${path}/greeting`), + ...getMemberValidator("farewell").validate(obj.farewell, `${path}/farewell`), + ]; + }; +} + /** * @public */ @@ -4150,6 +4578,459 @@ export namespace OmitsSerializingEmptyListsInput { }; } +/** + * @public + */ +export interface OperationWithDefaultsInput { + defaults?: Defaults; + clientOptionalDefaults?: ClientOptionalDefaults; + topLevelDefault?: string; + otherTopLevelDefault?: number; +} + +export namespace OperationWithDefaultsInput { + const memberValidators: { + defaults?: __MultiConstraintValidator; + clientOptionalDefaults?: __MultiConstraintValidator; + topLevelDefault?: __MultiConstraintValidator; + otherTopLevelDefault?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: OperationWithDefaultsInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "defaults": { + memberValidators["defaults"] = new __CompositeStructureValidator( + new __NoOpValidator(), + Defaults.validate + ); + break; + } + case "clientOptionalDefaults": { + memberValidators["clientOptionalDefaults"] = new __CompositeStructureValidator( + new __NoOpValidator(), + ClientOptionalDefaults.validate + ); + break; + } + case "topLevelDefault": { + memberValidators["topLevelDefault"] = new __NoOpValidator(); + break; + } + case "otherTopLevelDefault": { + memberValidators["otherTopLevelDefault"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("defaults").validate(obj.defaults, `${path}/defaults`), + ...getMemberValidator("clientOptionalDefaults").validate( + obj.clientOptionalDefaults, + `${path}/clientOptionalDefaults` + ), + ...getMemberValidator("topLevelDefault").validate(obj.topLevelDefault, `${path}/topLevelDefault`), + ...getMemberValidator("otherTopLevelDefault").validate(obj.otherTopLevelDefault, `${path}/otherTopLevelDefault`), + ]; + }; +} + +/** + * @public + */ +export interface OperationWithDefaultsOutput { + defaultString?: string; + defaultBoolean?: boolean; + defaultList?: string[]; + defaultDocumentMap?: __DocumentType; + defaultDocumentString?: __DocumentType; + defaultDocumentBoolean?: __DocumentType; + defaultDocumentList?: __DocumentType; + defaultNullDocument?: __DocumentType; + defaultTimestamp?: Date; + defaultBlob?: Uint8Array; + defaultByte?: number; + defaultShort?: number; + defaultInteger?: number; + defaultLong?: number; + defaultFloat?: number; + defaultDouble?: number; + defaultMap?: Record; + defaultEnum?: TestEnum; + defaultIntEnum?: TestIntEnum; + emptyString?: string; + falseBoolean?: boolean; + emptyBlob?: Uint8Array; + zeroByte?: number; + zeroShort?: number; + zeroInteger?: number; + zeroLong?: number; + zeroFloat?: number; + zeroDouble?: number; +} + +export namespace OperationWithDefaultsOutput { + const memberValidators: { + defaultString?: __MultiConstraintValidator; + defaultBoolean?: __MultiConstraintValidator; + defaultList?: __MultiConstraintValidator>; + defaultDocumentMap?: __MultiConstraintValidator<__DocumentType>; + defaultDocumentString?: __MultiConstraintValidator<__DocumentType>; + defaultDocumentBoolean?: __MultiConstraintValidator<__DocumentType>; + defaultDocumentList?: __MultiConstraintValidator<__DocumentType>; + defaultNullDocument?: __MultiConstraintValidator<__DocumentType>; + defaultTimestamp?: __MultiConstraintValidator; + defaultBlob?: __MultiConstraintValidator; + defaultByte?: __MultiConstraintValidator; + defaultShort?: __MultiConstraintValidator; + defaultInteger?: __MultiConstraintValidator; + defaultLong?: __MultiConstraintValidator; + defaultFloat?: __MultiConstraintValidator; + defaultDouble?: __MultiConstraintValidator; + defaultMap?: __MultiConstraintValidator>; + defaultEnum?: __MultiConstraintValidator; + defaultIntEnum?: __MultiConstraintValidator; + emptyString?: __MultiConstraintValidator; + falseBoolean?: __MultiConstraintValidator; + emptyBlob?: __MultiConstraintValidator; + zeroByte?: __MultiConstraintValidator; + zeroShort?: __MultiConstraintValidator; + zeroInteger?: __MultiConstraintValidator; + zeroLong?: __MultiConstraintValidator; + zeroFloat?: __MultiConstraintValidator; + zeroDouble?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: OperationWithDefaultsOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "defaultString": { + memberValidators["defaultString"] = new __NoOpValidator(); + break; + } + case "defaultBoolean": { + memberValidators["defaultBoolean"] = new __NoOpValidator(); + break; + } + case "defaultList": { + memberValidators["defaultList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "defaultDocumentMap": { + memberValidators["defaultDocumentMap"] = new __NoOpValidator(); + break; + } + case "defaultDocumentString": { + memberValidators["defaultDocumentString"] = new __NoOpValidator(); + break; + } + case "defaultDocumentBoolean": { + memberValidators["defaultDocumentBoolean"] = new __NoOpValidator(); + break; + } + case "defaultDocumentList": { + memberValidators["defaultDocumentList"] = new __NoOpValidator(); + break; + } + case "defaultNullDocument": { + memberValidators["defaultNullDocument"] = new __NoOpValidator(); + break; + } + case "defaultTimestamp": { + memberValidators["defaultTimestamp"] = new __NoOpValidator(); + break; + } + case "defaultBlob": { + memberValidators["defaultBlob"] = new __NoOpValidator(); + break; + } + case "defaultByte": { + memberValidators["defaultByte"] = new __NoOpValidator(); + break; + } + case "defaultShort": { + memberValidators["defaultShort"] = new __NoOpValidator(); + break; + } + case "defaultInteger": { + memberValidators["defaultInteger"] = new __NoOpValidator(); + break; + } + case "defaultLong": { + memberValidators["defaultLong"] = new __NoOpValidator(); + break; + } + case "defaultFloat": { + memberValidators["defaultFloat"] = new __NoOpValidator(); + break; + } + case "defaultDouble": { + memberValidators["defaultDouble"] = new __NoOpValidator(); + break; + } + case "defaultMap": { + memberValidators["defaultMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __NoOpValidator() + ); + break; + } + case "defaultEnum": { + memberValidators["defaultEnum"] = new __CompositeValidator([ + new __EnumValidator(["FOO", "BAR", "BAZ"], ["FOO", "BAR", "BAZ"]), + ]); + break; + } + case "defaultIntEnum": { + memberValidators["defaultIntEnum"] = new __CompositeValidator([new __IntegerEnumValidator([1, 2])]); + break; + } + case "emptyString": { + memberValidators["emptyString"] = new __NoOpValidator(); + break; + } + case "falseBoolean": { + memberValidators["falseBoolean"] = new __NoOpValidator(); + break; + } + case "emptyBlob": { + memberValidators["emptyBlob"] = new __NoOpValidator(); + break; + } + case "zeroByte": { + memberValidators["zeroByte"] = new __NoOpValidator(); + break; + } + case "zeroShort": { + memberValidators["zeroShort"] = new __NoOpValidator(); + break; + } + case "zeroInteger": { + memberValidators["zeroInteger"] = new __NoOpValidator(); + break; + } + case "zeroLong": { + memberValidators["zeroLong"] = new __NoOpValidator(); + break; + } + case "zeroFloat": { + memberValidators["zeroFloat"] = new __NoOpValidator(); + break; + } + case "zeroDouble": { + memberValidators["zeroDouble"] = new __NoOpValidator(); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("defaultString").validate(obj.defaultString, `${path}/defaultString`), + ...getMemberValidator("defaultBoolean").validate(obj.defaultBoolean, `${path}/defaultBoolean`), + ...getMemberValidator("defaultList").validate(obj.defaultList, `${path}/defaultList`), + ...getMemberValidator("defaultDocumentMap").validate(obj.defaultDocumentMap, `${path}/defaultDocumentMap`), + ...getMemberValidator("defaultDocumentString").validate( + obj.defaultDocumentString, + `${path}/defaultDocumentString` + ), + ...getMemberValidator("defaultDocumentBoolean").validate( + obj.defaultDocumentBoolean, + `${path}/defaultDocumentBoolean` + ), + ...getMemberValidator("defaultDocumentList").validate(obj.defaultDocumentList, `${path}/defaultDocumentList`), + ...getMemberValidator("defaultNullDocument").validate(obj.defaultNullDocument, `${path}/defaultNullDocument`), + ...getMemberValidator("defaultTimestamp").validate(obj.defaultTimestamp, `${path}/defaultTimestamp`), + ...getMemberValidator("defaultBlob").validate(obj.defaultBlob, `${path}/defaultBlob`), + ...getMemberValidator("defaultByte").validate(obj.defaultByte, `${path}/defaultByte`), + ...getMemberValidator("defaultShort").validate(obj.defaultShort, `${path}/defaultShort`), + ...getMemberValidator("defaultInteger").validate(obj.defaultInteger, `${path}/defaultInteger`), + ...getMemberValidator("defaultLong").validate(obj.defaultLong, `${path}/defaultLong`), + ...getMemberValidator("defaultFloat").validate(obj.defaultFloat, `${path}/defaultFloat`), + ...getMemberValidator("defaultDouble").validate(obj.defaultDouble, `${path}/defaultDouble`), + ...getMemberValidator("defaultMap").validate(obj.defaultMap, `${path}/defaultMap`), + ...getMemberValidator("defaultEnum").validate(obj.defaultEnum, `${path}/defaultEnum`), + ...getMemberValidator("defaultIntEnum").validate(obj.defaultIntEnum, `${path}/defaultIntEnum`), + ...getMemberValidator("emptyString").validate(obj.emptyString, `${path}/emptyString`), + ...getMemberValidator("falseBoolean").validate(obj.falseBoolean, `${path}/falseBoolean`), + ...getMemberValidator("emptyBlob").validate(obj.emptyBlob, `${path}/emptyBlob`), + ...getMemberValidator("zeroByte").validate(obj.zeroByte, `${path}/zeroByte`), + ...getMemberValidator("zeroShort").validate(obj.zeroShort, `${path}/zeroShort`), + ...getMemberValidator("zeroInteger").validate(obj.zeroInteger, `${path}/zeroInteger`), + ...getMemberValidator("zeroLong").validate(obj.zeroLong, `${path}/zeroLong`), + ...getMemberValidator("zeroFloat").validate(obj.zeroFloat, `${path}/zeroFloat`), + ...getMemberValidator("zeroDouble").validate(obj.zeroDouble, `${path}/zeroDouble`), + ]; + }; +} + +/** + * @public + */ +export interface TopLevel { + dialog: Dialog | undefined; + dialogList?: Dialog[]; + dialogMap?: Record; +} + +export namespace TopLevel { + const memberValidators: { + dialog?: __MultiConstraintValidator; + dialogList?: __MultiConstraintValidator>; + dialogMap?: __MultiConstraintValidator>; + } = {}; + /** + * @internal + */ + export const validate = (obj: TopLevel, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "dialog": { + memberValidators["dialog"] = new __CompositeStructureValidator( + new __CompositeValidator([new __RequiredValidator()]), + Dialog.validate + ); + break; + } + case "dialogList": { + memberValidators["dialogList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __CompositeStructureValidator(new __NoOpValidator(), Dialog.validate) + ); + break; + } + case "dialogMap": { + memberValidators["dialogMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __CompositeStructureValidator(new __NoOpValidator(), Dialog.validate) + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("dialog").validate(obj.dialog, `${path}/dialog`), + ...getMemberValidator("dialogList").validate(obj.dialogList, `${path}/dialogList`), + ...getMemberValidator("dialogMap").validate(obj.dialogMap, `${path}/dialogMap`), + ]; + }; +} + +/** + * @public + */ +export interface OperationWithNestedStructureInput { + topLevel: TopLevel | undefined; +} + +export namespace OperationWithNestedStructureInput { + const memberValidators: { + topLevel?: __MultiConstraintValidator; + } = {}; + /** + * @internal + */ + export const validate = (obj: OperationWithNestedStructureInput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "topLevel": { + memberValidators["topLevel"] = new __CompositeStructureValidator( + new __CompositeValidator([new __RequiredValidator()]), + TopLevel.validate + ); + break; + } + } + } + return memberValidators[member]!; + } + return [...getMemberValidator("topLevel").validate(obj.topLevel, `${path}/topLevel`)]; + }; +} + +/** + * @public + */ +export interface OperationWithNestedStructureOutput { + dialog: Dialog | undefined; + dialogList?: Dialog[]; + dialogMap?: Record; +} + +export namespace OperationWithNestedStructureOutput { + const memberValidators: { + dialog?: __MultiConstraintValidator; + dialogList?: __MultiConstraintValidator>; + dialogMap?: __MultiConstraintValidator>; + } = {}; + /** + * @internal + */ + export const validate = (obj: OperationWithNestedStructureOutput, path = ""): __ValidationFailure[] => { + function getMemberValidator( + member: T + ): NonNullable<(typeof memberValidators)[T]> { + if (memberValidators[member] === undefined) { + switch (member) { + case "dialog": { + memberValidators["dialog"] = new __CompositeStructureValidator( + new __CompositeValidator([new __RequiredValidator()]), + Dialog.validate + ); + break; + } + case "dialogList": { + memberValidators["dialogList"] = new __CompositeCollectionValidator( + new __NoOpValidator(), + new __CompositeStructureValidator(new __NoOpValidator(), Dialog.validate) + ); + break; + } + case "dialogMap": { + memberValidators["dialogMap"] = new __CompositeMapValidator( + new __NoOpValidator(), + new __NoOpValidator(), + new __CompositeStructureValidator(new __NoOpValidator(), Dialog.validate) + ); + break; + } + } + } + return memberValidators[member]!; + } + return [ + ...getMemberValidator("dialog").validate(obj.dialog, `${path}/dialog`), + ...getMemberValidator("dialogList").validate(obj.dialogList, `${path}/dialogList`), + ...getMemberValidator("dialogMap").validate(obj.dialogMap, `${path}/dialogMap`), + ]; + }; +} + /** * @public */ diff --git a/private/aws-restjson-server/src/protocols/Aws_restJson1.ts b/private/aws-restjson-server/src/protocols/Aws_restJson1.ts index 47e3c4b69c51..644bc1729827 100644 --- a/private/aws-restjson-server/src/protocols/Aws_restJson1.ts +++ b/private/aws-restjson-server/src/protocols/Aws_restJson1.ts @@ -56,8 +56,12 @@ import { import { calculateBodyLength } from "@smithy/util-body-length-node"; import { + ClientOptionalDefaults, ComplexError, ComplexNestedErrorData, + Defaults, + Dialog, + Farewell, FooEnum, FooError, GreetingStruct, @@ -73,6 +77,7 @@ import { SimpleUnion, StructureListMember, TestConfig, + TopLevel, UnionPayload, UnionWithJsonName, Unit, @@ -89,6 +94,10 @@ import { ConstantQueryStringServerInput, ConstantQueryStringServerOutput, } from "../server/operations/ConstantQueryString"; +import { + ContentTypeParametersServerInput, + ContentTypeParametersServerOutput, +} from "../server/operations/ContentTypeParameters"; import { DatetimeOffsetsServerInput, DatetimeOffsetsServerOutput } from "../server/operations/DatetimeOffsets"; import { DocumentTypeServerInput, DocumentTypeServerOutput } from "../server/operations/DocumentType"; import { @@ -285,6 +294,14 @@ import { OmitsSerializingEmptyListsServerInput, OmitsSerializingEmptyListsServerOutput, } from "../server/operations/OmitsSerializingEmptyLists"; +import { + OperationWithDefaultsServerInput, + OperationWithDefaultsServerOutput, +} from "../server/operations/OperationWithDefaults"; +import { + OperationWithNestedStructureServerInput, + OperationWithNestedStructureServerOutput, +} from "../server/operations/OperationWithNestedStructure"; import { PostPlayerActionServerInput, PostPlayerActionServerOutput } from "../server/operations/PostPlayerAction"; import { PostUnionWithJsonNameServerInput, @@ -320,6 +337,10 @@ import { StreamingTraitsWithMediaTypeServerOutput, } from "../server/operations/StreamingTraitsWithMediaType"; import { TestBodyStructureServerInput, TestBodyStructureServerOutput } from "../server/operations/TestBodyStructure"; +import { + TestNoInputNoPayloadServerInput, + TestNoInputNoPayloadServerOutput, +} from "../server/operations/TestNoInputNoPayload"; import { TestNoPayloadServerInput, TestNoPayloadServerOutput } from "../server/operations/TestNoPayload"; import { TestPayloadBlobServerInput, TestPayloadBlobServerOutput } from "../server/operations/TestPayloadBlob"; import { @@ -648,6 +669,35 @@ export const deserializeConstantQueryStringRequest = async ( return contents; }; +export const deserializeContentTypeParametersRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey != null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey != null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: any = map({}); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + value: __expectInt32, + }); + Object.assign(contents, doc); + return contents; +}; + export const deserializeDatetimeOffsetsRequest = async ( output: __HttpRequest, context: __SerdeContext @@ -3054,6 +3104,67 @@ export const deserializeOmitsSerializingEmptyListsRequest = async ( return contents; }; +export const deserializeOperationWithDefaultsRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey != null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey != null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: any = map({}); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + clientOptionalDefaults: (_) => de_ClientOptionalDefaults(_, context), + defaults: (_) => de_Defaults(_, context), + otherTopLevelDefault: __expectInt32, + topLevelDefault: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + +export const deserializeOperationWithNestedStructureRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey != null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined && contentType !== "application/json") { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey != null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: any = map({}); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + topLevel: (_) => de_TopLevel(_, context), + }); + Object.assign(contents, doc); + return contents; +}; + export const deserializePostPlayerActionRequest = async ( output: __HttpRequest, context: __SerdeContext @@ -3508,6 +3619,31 @@ export const deserializeTestBodyStructureRequest = async ( return contents; }; +export const deserializeTestNoInputNoPayloadRequest = async ( + output: __HttpRequest, + context: __SerdeContext +): Promise => { + const contentTypeHeaderKey: string | undefined = Object.keys(output.headers).find( + (key) => key.toLowerCase() === "content-type" + ); + if (contentTypeHeaderKey != null) { + const contentType = output.headers[contentTypeHeaderKey]; + if (contentType !== undefined) { + throw new __UnsupportedMediaTypeException(); + } + } + const acceptHeaderKey: string | undefined = Object.keys(output.headers).find((key) => key.toLowerCase() === "accept"); + if (acceptHeaderKey != null) { + const accept = output.headers[acceptHeaderKey]; + if (!__acceptMatches(accept, "application/json")) { + throw new __NotAcceptableException(); + } + } + const contents: any = map({}); + await collectBody(output.body, context); + return contents; +}; + export const deserializeTestNoPayloadRequest = async ( output: __HttpRequest, context: __SerdeContext @@ -3747,6 +3883,43 @@ export const serializeConstantQueryStringResponse = async ( }); }; +export const serializeContentTypeParametersResponse = async ( + input: ContentTypeParametersServerOutput, + ctx: ServerSerdeContext +): Promise<__HttpResponse> => { + const context: __SerdeContext = { + ...ctx, + endpoint: () => + Promise.resolve({ + protocol: "", + hostname: "", + path: "", + }), + }; + const statusCode = 200; + let headers: any = map({}, isSerializableHeaderValue, { + "content-type": "application/json", + }); + let body: any; + body = "{}"; + if ( + body && + Object.keys(headers) + .map((str) => str.toLowerCase()) + .indexOf("content-length") === -1 + ) { + const length = calculateBodyLength(body); + if (length !== undefined) { + headers = { ...headers, "content-length": String(length) }; + } + } + return new __HttpResponse({ + headers, + body, + statusCode, + }); +}; + export const serializeDatetimeOffsetsResponse = async ( input: DatetimeOffsetsServerOutput, ctx: ServerSerdeContext @@ -6522,6 +6695,117 @@ export const serializeOmitsSerializingEmptyListsResponse = async ( }); }; +export const serializeOperationWithDefaultsResponse = async ( + input: OperationWithDefaultsServerOutput, + ctx: ServerSerdeContext +): Promise<__HttpResponse> => { + const context: __SerdeContext = { + ...ctx, + endpoint: () => + Promise.resolve({ + protocol: "", + hostname: "", + path: "", + }), + }; + const statusCode = 200; + let headers: any = map({}, isSerializableHeaderValue, { + "content-type": "application/json", + }); + let body: any; + body = JSON.stringify( + take(input, { + defaultBlob: (_) => context.base64Encoder(_), + defaultBoolean: [], + defaultByte: [], + defaultDocumentBoolean: (_) => se_Document(_, context), + defaultDocumentList: (_) => se_Document(_, context), + defaultDocumentMap: (_) => se_Document(_, context), + defaultDocumentString: (_) => se_Document(_, context), + defaultDouble: (_) => __serializeFloat(_), + defaultEnum: [], + defaultFloat: (_) => __serializeFloat(_), + defaultIntEnum: [], + defaultInteger: [], + defaultList: (_) => se_TestStringList(_, context), + defaultLong: [], + defaultMap: (_) => se_TestStringMap(_, context), + defaultNullDocument: (_) => se_Document(_, context), + defaultShort: [], + defaultString: [], + defaultTimestamp: (_) => _.getTime() / 1_000, + emptyBlob: (_) => context.base64Encoder(_), + emptyString: [], + falseBoolean: [], + zeroByte: [], + zeroDouble: (_) => __serializeFloat(_), + zeroFloat: (_) => __serializeFloat(_), + zeroInteger: [], + zeroLong: [], + zeroShort: [], + }) + ); + if ( + body && + Object.keys(headers) + .map((str) => str.toLowerCase()) + .indexOf("content-length") === -1 + ) { + const length = calculateBodyLength(body); + if (length !== undefined) { + headers = { ...headers, "content-length": String(length) }; + } + } + return new __HttpResponse({ + headers, + body, + statusCode, + }); +}; + +export const serializeOperationWithNestedStructureResponse = async ( + input: OperationWithNestedStructureServerOutput, + ctx: ServerSerdeContext +): Promise<__HttpResponse> => { + const context: __SerdeContext = { + ...ctx, + endpoint: () => + Promise.resolve({ + protocol: "", + hostname: "", + path: "", + }), + }; + const statusCode = 200; + let headers: any = map({}, isSerializableHeaderValue, { + "content-type": "application/json", + }); + let body: any; + body = JSON.stringify( + take(input, { + dialog: (_) => se_Dialog(_, context), + dialogList: (_) => se_DialogList(_, context), + dialogMap: (_) => se_DialogMap(_, context), + }) + ); + if ( + body && + Object.keys(headers) + .map((str) => str.toLowerCase()) + .indexOf("content-length") === -1 + ) { + const length = calculateBodyLength(body); + if (length !== undefined) { + headers = { ...headers, "content-length": String(length) }; + } + } + return new __HttpResponse({ + headers, + body, + statusCode, + }); +}; + export const serializePostPlayerActionResponse = async ( input: PostPlayerActionServerOutput, ctx: ServerSerdeContext @@ -7073,6 +7357,44 @@ export const serializeTestBodyStructureResponse = async ( }); }; +export const serializeTestNoInputNoPayloadResponse = async ( + input: TestNoInputNoPayloadServerOutput, + ctx: ServerSerdeContext +): Promise<__HttpResponse> => { + const context: __SerdeContext = { + ...ctx, + endpoint: () => + Promise.resolve({ + protocol: "", + hostname: "", + path: "", + }), + }; + const statusCode = 200; + let headers: any = map({}, isSerializableHeaderValue, { + "content-type": "application/json", + [_xati]: input[_tI]!, + }); + let body: any; + body = "{}"; + if ( + body && + Object.keys(headers) + .map((str) => str.toLowerCase()) + .indexOf("content-length") === -1 + ) { + const length = calculateBodyLength(body); + if (length !== undefined) { + headers = { ...headers, "content-length": String(length) }; + } + } + return new __HttpResponse({ + headers, + body, + statusCode, + }); +}; + export const serializeTestNoPayloadResponse = async ( input: TestNoPayloadServerOutput, ctx: ServerSerdeContext @@ -7521,6 +7843,41 @@ const se_DenseStructMap = (input: Record, context: __Ser }, {}); }; +/** + * serializeAws_restJson1Dialog + */ +const se_Dialog = (input: Dialog, context: __SerdeContext): any => { + return take(input, { + farewell: (_) => se_Farewell(_, context), + greeting: [], + language: [], + }); +}; + +/** + * serializeAws_restJson1DialogList + */ +const se_DialogList = (input: Dialog[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + return se_Dialog(entry, context); + }); +}; + +/** + * serializeAws_restJson1DialogMap + */ +const se_DialogMap = (input: Record, context: __SerdeContext): any => { + return Object.entries(input).reduce((acc: Record, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + acc[key] = se_Dialog(value, context); + return acc; + }, {}); +}; + /** * serializeAws_restJson1Document */ @@ -7541,6 +7898,15 @@ const se_DocumentValuedMap = (input: Record, context: __ }, {}); }; +/** + * serializeAws_restJson1Farewell + */ +const se_Farewell = (input: Farewell, context: __SerdeContext): any => { + return take(input, { + phrase: [], + }); +}; + /** * serializeAws_restJson1MyUnion */ @@ -7701,6 +8067,26 @@ const se_TestConfig = (input: TestConfig, context: __SerdeContext): any => { }); }; +/** + * serializeAws_restJson1TestStringList + */ +const se_TestStringList = (input: string[], context: __SerdeContext): any => { + return input.filter((e: any) => e != null); +}; + +/** + * serializeAws_restJson1TestStringMap + */ +const se_TestStringMap = (input: Record, context: __SerdeContext): any => { + return Object.entries(input).reduce((acc: Record, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + acc[key] = value; + return acc; + }, {}); +}; + /** * serializeAws_restJson1UnionPayload */ @@ -7886,6 +8272,51 @@ const se_Unit = (input: Unit, context: __SerdeContext): any => { return take(input, {}); }; +/** + * deserializeAws_restJson1ClientOptionalDefaults + */ +const de_ClientOptionalDefaults = (output: any, context: __SerdeContext): ClientOptionalDefaults => { + return take(output, { + member: __expectInt32, + }) as any; +}; + +/** + * deserializeAws_restJson1Defaults + */ +const de_Defaults = (output: any, context: __SerdeContext): Defaults => { + return take(output, { + defaultBlob: context.base64Decoder, + defaultBoolean: __expectBoolean, + defaultByte: __expectByte, + defaultDocumentBoolean: (_: any) => de_Document(_, context), + defaultDocumentList: (_: any) => de_Document(_, context), + defaultDocumentMap: (_: any) => de_Document(_, context), + defaultDocumentString: (_: any) => de_Document(_, context), + defaultDouble: __limitedParseDouble, + defaultEnum: __expectString, + defaultFloat: __limitedParseFloat32, + defaultIntEnum: __expectInt32, + defaultInteger: __expectInt32, + defaultList: (_: any) => de_TestStringList(_, context), + defaultLong: __expectLong, + defaultMap: (_: any) => de_TestStringMap(_, context), + defaultNullDocument: (_: any) => de_Document(_, context), + defaultShort: __expectShort, + defaultString: __expectString, + defaultTimestamp: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + emptyBlob: context.base64Decoder, + emptyString: __expectString, + falseBoolean: __expectBoolean, + zeroByte: __expectByte, + zeroDouble: __limitedParseDouble, + zeroFloat: __limitedParseFloat32, + zeroInteger: __expectInt32, + zeroLong: __expectLong, + zeroShort: __expectShort, + }) as any; +}; + /** * deserializeAws_restJson1DenseBooleanMap */ @@ -7951,6 +8382,45 @@ const de_DenseStructMap = (output: any, context: __SerdeContext): Record); }; +/** + * deserializeAws_restJson1Dialog + */ +const de_Dialog = (output: any, context: __SerdeContext): Dialog => { + return take(output, { + farewell: (_: any) => de_Farewell(_, context), + greeting: __expectString, + language: __expectString, + }) as any; +}; + +/** + * deserializeAws_restJson1DialogList + */ +const de_DialogList = (output: any, context: __SerdeContext): Dialog[] => { + const retVal = (output || []).map((entry: any) => { + if (entry === null) { + throw new TypeError( + 'All elements of the non-sparse list "aws.protocoltests.restjson#DialogList" must be non-null.' + ); + } + return de_Dialog(entry, context); + }); + return retVal; +}; + +/** + * deserializeAws_restJson1DialogMap + */ +const de_DialogMap = (output: any, context: __SerdeContext): Record => { + return Object.entries(output).reduce((acc: Record, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + acc[key as string] = de_Dialog(value, context); + return acc; + }, {} as Record); +}; + /** * deserializeAws_restJson1Document */ @@ -7971,6 +8441,15 @@ const de_DocumentValuedMap = (output: any, context: __SerdeContext): Record); }; +/** + * deserializeAws_restJson1Farewell + */ +const de_Farewell = (output: any, context: __SerdeContext): Farewell => { + return take(output, { + phrase: __expectString, + }) as any; +}; + /** * deserializeAws_restJson1MyUnion */ @@ -8208,6 +8687,45 @@ const de_TestConfig = (output: any, context: __SerdeContext): TestConfig => { }) as any; }; +/** + * deserializeAws_restJson1TestStringList + */ +const de_TestStringList = (output: any, context: __SerdeContext): string[] => { + const retVal = (output || []).map((entry: any) => { + if (entry === null) { + throw new TypeError( + 'All elements of the non-sparse list "aws.protocoltests.restjson#TestStringList" must be non-null.' + ); + } + return __expectString(entry) as any; + }); + return retVal; +}; + +/** + * deserializeAws_restJson1TestStringMap + */ +const de_TestStringMap = (output: any, context: __SerdeContext): Record => { + return Object.entries(output).reduce((acc: Record, [key, value]: [string, any]) => { + if (value === null) { + return acc; + } + acc[key as string] = __expectString(value) as any; + return acc; + }, {} as Record); +}; + +/** + * deserializeAws_restJson1TopLevel + */ +const de_TopLevel = (output: any, context: __SerdeContext): TopLevel => { + return take(output, { + dialog: (_: any) => de_Dialog(_, context), + dialogList: (_: any) => de_DialogList(_, context), + dialogMap: (_: any) => de_DialogMap(_, context), + }) as any; +}; + /** * deserializeAws_restJson1UnionPayload */ diff --git a/private/aws-restjson-server/src/server/RestJsonService.ts b/private/aws-restjson-server/src/server/RestJsonService.ts index e6ed22e97385..2a5d96fa1227 100644 --- a/private/aws-restjson-server/src/server/RestJsonService.ts +++ b/private/aws-restjson-server/src/server/RestJsonService.ts @@ -38,6 +38,11 @@ import { ConstantQueryStringSerializer, ConstantQueryStringServerInput, } from "./operations/ConstantQueryString"; +import { + ContentTypeParameters, + ContentTypeParametersSerializer, + ContentTypeParametersServerInput, +} from "./operations/ContentTypeParameters"; import { DatetimeOffsets, DatetimeOffsetsSerializer, DatetimeOffsetsServerInput } from "./operations/DatetimeOffsets"; import { DocumentType, DocumentTypeSerializer, DocumentTypeServerInput } from "./operations/DocumentType"; import { @@ -319,6 +324,16 @@ import { OmitsSerializingEmptyListsSerializer, OmitsSerializingEmptyListsServerInput, } from "./operations/OmitsSerializingEmptyLists"; +import { + OperationWithDefaults, + OperationWithDefaultsSerializer, + OperationWithDefaultsServerInput, +} from "./operations/OperationWithDefaults"; +import { + OperationWithNestedStructure, + OperationWithNestedStructureSerializer, + OperationWithNestedStructureServerInput, +} from "./operations/OperationWithNestedStructure"; import { PostPlayerAction, PostPlayerActionSerializer, @@ -369,6 +384,11 @@ import { TestBodyStructureSerializer, TestBodyStructureServerInput, } from "./operations/TestBodyStructure"; +import { + TestNoInputNoPayload, + TestNoInputNoPayloadSerializer, + TestNoInputNoPayloadServerInput, +} from "./operations/TestNoInputNoPayload"; import { TestNoPayload, TestNoPayloadSerializer, TestNoPayloadServerInput } from "./operations/TestNoPayload"; import { TestPayloadBlob, TestPayloadBlobSerializer, TestPayloadBlobServerInput } from "./operations/TestPayloadBlob"; import { @@ -391,6 +411,7 @@ export type RestJsonServiceOperations = | "AllQueryStringTypes" | "ConstantAndVariableQueryString" | "ConstantQueryString" + | "ContentTypeParameters" | "DatetimeOffsets" | "DocumentType" | "DocumentTypeAsMapValue" @@ -464,6 +485,8 @@ export type RestJsonServiceOperations = | "NullAndEmptyHeadersServer" | "OmitsNullSerializesEmptyString" | "OmitsSerializingEmptyLists" + | "OperationWithDefaults" + | "OperationWithNestedStructure" | "PostPlayerAction" | "PostUnionWithJsonName" | "PutWithContentEncoding" @@ -478,6 +501,7 @@ export type RestJsonServiceOperations = | "StreamingTraitsRequireLength" | "StreamingTraitsWithMediaType" | "TestBodyStructure" + | "TestNoInputNoPayload" | "TestNoPayload" | "TestPayloadBlob" | "TestPayloadStructure" @@ -487,6 +511,7 @@ export interface RestJsonService { AllQueryStringTypes: AllQueryStringTypes; ConstantAndVariableQueryString: ConstantAndVariableQueryString; ConstantQueryString: ConstantQueryString; + ContentTypeParameters: ContentTypeParameters; DatetimeOffsets: DatetimeOffsets; DocumentType: DocumentType; DocumentTypeAsMapValue: DocumentTypeAsMapValue; @@ -560,6 +585,8 @@ export interface RestJsonService { NullAndEmptyHeadersServer: NullAndEmptyHeadersServer; OmitsNullSerializesEmptyString: OmitsNullSerializesEmptyString; OmitsSerializingEmptyLists: OmitsSerializingEmptyLists; + OperationWithDefaults: OperationWithDefaults; + OperationWithNestedStructure: OperationWithNestedStructure; PostPlayerAction: PostPlayerAction; PostUnionWithJsonName: PostUnionWithJsonName; PutWithContentEncoding: PutWithContentEncoding; @@ -574,6 +601,7 @@ export interface RestJsonService { StreamingTraitsRequireLength: StreamingTraitsRequireLength; StreamingTraitsWithMediaType: StreamingTraitsWithMediaType; TestBodyStructure: TestBodyStructure; + TestNoInputNoPayload: TestNoInputNoPayload; TestNoPayload: TestNoPayload; TestPayloadBlob: TestPayloadBlob; TestPayloadStructure: TestPayloadStructure; @@ -706,6 +734,18 @@ export class RestJsonServiceHandler implements __ServiceHandler implements __ServiceHandler implements __ServiceHandler( ], { service: "RestJson", operation: "ConstantQueryString" } ), + new httpbinding.UriSpec<"RestJson", "ContentTypeParameters">( + "POST", + [{ type: "path_literal", value: "ContentTypeParameters" }], + [], + { service: "RestJson", operation: "ContentTypeParameters" } + ), new httpbinding.UriSpec<"RestJson", "DatetimeOffsets">( "POST", [{ type: "path_literal", value: "DatetimeOffsets" }], @@ -2287,6 +2369,18 @@ export const getRestJsonServiceHandler = ( [], { service: "RestJson", operation: "OmitsSerializingEmptyLists" } ), + new httpbinding.UriSpec<"RestJson", "OperationWithDefaults">( + "POST", + [{ type: "path_literal", value: "OperationWithDefaults" }], + [], + { service: "RestJson", operation: "OperationWithDefaults" } + ), + new httpbinding.UriSpec<"RestJson", "OperationWithNestedStructure">( + "POST", + [{ type: "path_literal", value: "OperationWithNestedStructure" }], + [], + { service: "RestJson", operation: "OperationWithNestedStructure" } + ), new httpbinding.UriSpec<"RestJson", "PostPlayerAction">( "POST", [{ type: "path_literal", value: "PostPlayerAction" }], @@ -2372,6 +2466,12 @@ export const getRestJsonServiceHandler = ( service: "RestJson", operation: "TestBodyStructure", }), + new httpbinding.UriSpec<"RestJson", "TestNoInputNoPayload">( + "GET", + [{ type: "path_literal", value: "no_input_no_payload" }], + [], + { service: "RestJson", operation: "TestNoInputNoPayload" } + ), new httpbinding.UriSpec<"RestJson", "TestNoPayload">("GET", [{ type: "path_literal", value: "no_payload" }], [], { service: "RestJson", operation: "TestNoPayload", @@ -2411,6 +2511,8 @@ export const getRestJsonServiceHandler = ( return new ConstantAndVariableQueryStringSerializer(); case "ConstantQueryString": return new ConstantQueryStringSerializer(); + case "ContentTypeParameters": + return new ContentTypeParametersSerializer(); case "DatetimeOffsets": return new DatetimeOffsetsSerializer(); case "DocumentType": @@ -2557,6 +2659,10 @@ export const getRestJsonServiceHandler = ( return new OmitsNullSerializesEmptyStringSerializer(); case "OmitsSerializingEmptyLists": return new OmitsSerializingEmptyListsSerializer(); + case "OperationWithDefaults": + return new OperationWithDefaultsSerializer(); + case "OperationWithNestedStructure": + return new OperationWithNestedStructureSerializer(); case "PostPlayerAction": return new PostPlayerActionSerializer(); case "PostUnionWithJsonName": @@ -2585,6 +2691,8 @@ export const getRestJsonServiceHandler = ( return new StreamingTraitsWithMediaTypeSerializer(); case "TestBodyStructure": return new TestBodyStructureSerializer(); + case "TestNoInputNoPayload": + return new TestNoInputNoPayloadSerializer(); case "TestNoPayload": return new TestNoPayloadSerializer(); case "TestPayloadBlob": diff --git a/private/aws-restjson-server/src/server/operations/ContentTypeParameters.ts b/private/aws-restjson-server/src/server/operations/ContentTypeParameters.ts new file mode 100644 index 000000000000..059edb3435da --- /dev/null +++ b/private/aws-restjson-server/src/server/operations/ContentTypeParameters.ts @@ -0,0 +1,190 @@ +// smithy-typescript generated code +import { + httpbinding, + InternalFailureException as __InternalFailureException, + isFrameworkException as __isFrameworkException, + Mux as __Mux, + Operation as __Operation, + OperationInput as __OperationInput, + OperationOutput as __OperationOutput, + OperationSerializer as __OperationSerializer, + SerializationException as __SerializationException, + ServerSerdeContext as __ServerSerdeContext, + ServerSerdeContext, + ServiceException as __ServiceException, + ServiceHandler as __ServiceHandler, + SmithyFrameworkException as __SmithyFrameworkException, + ValidationCustomizer as __ValidationCustomizer, + ValidationFailure as __ValidationFailure, +} from "@aws-smithy/server-common"; +import { NodeHttpHandler, streamCollector } from "@smithy/node-http-handler"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http"; +import { fromBase64, toBase64 } from "@smithy/util-base64"; +import { fromUtf8, toUtf8 } from "@smithy/util-utf8"; + +import { ContentTypeParametersInput, ContentTypeParametersOutput } from "../../models/models_0"; +import { + deserializeContentTypeParametersRequest, + serializeContentTypeParametersResponse, + serializeFrameworkException, +} from "../../protocols/Aws_restJson1"; +import { RestJsonService } from "../RestJsonService"; + +export type ContentTypeParameters = __Operation< + ContentTypeParametersServerInput, + ContentTypeParametersServerOutput, + Context +>; + +export interface ContentTypeParametersServerInput extends ContentTypeParametersInput {} +export namespace ContentTypeParametersServerInput { + /** + * @internal + */ + export const validate: (obj: Parameters[0]) => __ValidationFailure[] = + ContentTypeParametersInput.validate; +} +export interface ContentTypeParametersServerOutput extends ContentTypeParametersOutput {} + +export type ContentTypeParametersErrors = never; + +export class ContentTypeParametersSerializer + implements __OperationSerializer, "ContentTypeParameters", ContentTypeParametersErrors> +{ + serialize = serializeContentTypeParametersResponse; + deserialize = deserializeContentTypeParametersRequest; + + isOperationError(error: any): error is ContentTypeParametersErrors { + return false; + } + + serializeError(error: ContentTypeParametersErrors, ctx: ServerSerdeContext): Promise<__HttpResponse> { + throw error; + } +} + +export const getContentTypeParametersHandler = ( + operation: __Operation, + customizer: __ValidationCustomizer<"ContentTypeParameters"> +): __ServiceHandler => { + const mux = new httpbinding.HttpBindingMux<"RestJson", "ContentTypeParameters">([ + new httpbinding.UriSpec<"RestJson", "ContentTypeParameters">( + "POST", + [{ type: "path_literal", value: "ContentTypeParameters" }], + [], + { service: "RestJson", operation: "ContentTypeParameters" } + ), + ]); + return new ContentTypeParametersHandler( + operation, + mux, + new ContentTypeParametersSerializer(), + serializeFrameworkException, + customizer + ); +}; + +const serdeContextBase = { + base64Encoder: toBase64, + base64Decoder: fromBase64, + utf8Encoder: toUtf8, + utf8Decoder: fromUtf8, + streamCollector: streamCollector, + requestHandler: new NodeHttpHandler(), + disableHostPrefix: true, +}; +async function handle( + request: __HttpRequest, + context: Context, + operationName: O, + serializer: __OperationSerializer, + operation: __Operation<__OperationInput, __OperationOutput, Context>, + serializeFrameworkException: (e: __SmithyFrameworkException, ctx: __ServerSerdeContext) => Promise<__HttpResponse>, + validationFn: (input: __OperationInput) => __ValidationFailure[], + validationCustomizer: __ValidationCustomizer +): Promise<__HttpResponse> { + let input; + try { + input = await serializer.deserialize(request, { + endpoint: () => Promise.resolve(request), + ...serdeContextBase, + }); + } catch (error: unknown) { + if (__isFrameworkException(error)) { + return serializeFrameworkException(error, serdeContextBase); + } + return serializeFrameworkException(new __SerializationException(), serdeContextBase); + } + try { + const validationFailures = validationFn(input); + if (validationFailures && validationFailures.length > 0) { + const validationException = validationCustomizer({ operation: operationName }, validationFailures); + if (validationException) { + return serializer.serializeError(validationException, serdeContextBase); + } + } + const output = await operation(input, context); + return serializer.serialize(output, serdeContextBase); + } catch (error: unknown) { + if (serializer.isOperationError(error)) { + return serializer.serializeError(error, serdeContextBase); + } + console.log("Received an unexpected error", error); + return serializeFrameworkException(new __InternalFailureException(), serdeContextBase); + } +} +export class ContentTypeParametersHandler implements __ServiceHandler { + private readonly operation: __Operation; + private readonly mux: __Mux<"RestJson", "ContentTypeParameters">; + private readonly serializer: __OperationSerializer< + RestJsonService, + "ContentTypeParameters", + ContentTypeParametersErrors + >; + private readonly serializeFrameworkException: ( + e: __SmithyFrameworkException, + ctx: __ServerSerdeContext + ) => Promise<__HttpResponse>; + private readonly validationCustomizer: __ValidationCustomizer<"ContentTypeParameters">; + /** + * Construct a ContentTypeParameters handler. + * @param operation The {@link __Operation} implementation that supplies the business logic for ContentTypeParameters + * @param mux The {@link __Mux} that verifies which service and operation are being invoked by a given {@link __HttpRequest} + * @param serializer An {@link __OperationSerializer} for ContentTypeParameters that + * handles deserialization of requests and serialization of responses + * @param serializeFrameworkException A function that can serialize {@link __SmithyFrameworkException}s + * @param validationCustomizer A {@link __ValidationCustomizer} for turning validation failures into {@link __SmithyFrameworkException}s + */ + constructor( + operation: __Operation, + mux: __Mux<"RestJson", "ContentTypeParameters">, + serializer: __OperationSerializer, "ContentTypeParameters", ContentTypeParametersErrors>, + serializeFrameworkException: (e: __SmithyFrameworkException, ctx: __ServerSerdeContext) => Promise<__HttpResponse>, + validationCustomizer: __ValidationCustomizer<"ContentTypeParameters"> + ) { + this.operation = operation; + this.mux = mux; + this.serializer = serializer; + this.serializeFrameworkException = serializeFrameworkException; + this.validationCustomizer = validationCustomizer; + } + async handle(request: __HttpRequest, context: Context): Promise<__HttpResponse> { + const target = this.mux.match(request); + if (target === undefined) { + console.log( + "Received a request that did not match aws.protocoltests.restjson#RestJson.ContentTypeParameters. This indicates a misconfiguration." + ); + return this.serializeFrameworkException(new __InternalFailureException(), serdeContextBase); + } + return handle( + request, + context, + "ContentTypeParameters", + this.serializer, + this.operation, + this.serializeFrameworkException, + ContentTypeParametersServerInput.validate, + this.validationCustomizer + ); + } +} diff --git a/private/aws-restjson-server/src/server/operations/OperationWithDefaults.ts b/private/aws-restjson-server/src/server/operations/OperationWithDefaults.ts new file mode 100644 index 000000000000..009b89de1ec0 --- /dev/null +++ b/private/aws-restjson-server/src/server/operations/OperationWithDefaults.ts @@ -0,0 +1,190 @@ +// smithy-typescript generated code +import { + httpbinding, + InternalFailureException as __InternalFailureException, + isFrameworkException as __isFrameworkException, + Mux as __Mux, + Operation as __Operation, + OperationInput as __OperationInput, + OperationOutput as __OperationOutput, + OperationSerializer as __OperationSerializer, + SerializationException as __SerializationException, + ServerSerdeContext as __ServerSerdeContext, + ServerSerdeContext, + ServiceException as __ServiceException, + ServiceHandler as __ServiceHandler, + SmithyFrameworkException as __SmithyFrameworkException, + ValidationCustomizer as __ValidationCustomizer, + ValidationFailure as __ValidationFailure, +} from "@aws-smithy/server-common"; +import { NodeHttpHandler, streamCollector } from "@smithy/node-http-handler"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http"; +import { fromBase64, toBase64 } from "@smithy/util-base64"; +import { fromUtf8, toUtf8 } from "@smithy/util-utf8"; + +import { OperationWithDefaultsInput, OperationWithDefaultsOutput } from "../../models/models_0"; +import { + deserializeOperationWithDefaultsRequest, + serializeFrameworkException, + serializeOperationWithDefaultsResponse, +} from "../../protocols/Aws_restJson1"; +import { RestJsonService } from "../RestJsonService"; + +export type OperationWithDefaults = __Operation< + OperationWithDefaultsServerInput, + OperationWithDefaultsServerOutput, + Context +>; + +export interface OperationWithDefaultsServerInput extends OperationWithDefaultsInput {} +export namespace OperationWithDefaultsServerInput { + /** + * @internal + */ + export const validate: (obj: Parameters[0]) => __ValidationFailure[] = + OperationWithDefaultsInput.validate; +} +export interface OperationWithDefaultsServerOutput extends OperationWithDefaultsOutput {} + +export type OperationWithDefaultsErrors = never; + +export class OperationWithDefaultsSerializer + implements __OperationSerializer, "OperationWithDefaults", OperationWithDefaultsErrors> +{ + serialize = serializeOperationWithDefaultsResponse; + deserialize = deserializeOperationWithDefaultsRequest; + + isOperationError(error: any): error is OperationWithDefaultsErrors { + return false; + } + + serializeError(error: OperationWithDefaultsErrors, ctx: ServerSerdeContext): Promise<__HttpResponse> { + throw error; + } +} + +export const getOperationWithDefaultsHandler = ( + operation: __Operation, + customizer: __ValidationCustomizer<"OperationWithDefaults"> +): __ServiceHandler => { + const mux = new httpbinding.HttpBindingMux<"RestJson", "OperationWithDefaults">([ + new httpbinding.UriSpec<"RestJson", "OperationWithDefaults">( + "POST", + [{ type: "path_literal", value: "OperationWithDefaults" }], + [], + { service: "RestJson", operation: "OperationWithDefaults" } + ), + ]); + return new OperationWithDefaultsHandler( + operation, + mux, + new OperationWithDefaultsSerializer(), + serializeFrameworkException, + customizer + ); +}; + +const serdeContextBase = { + base64Encoder: toBase64, + base64Decoder: fromBase64, + utf8Encoder: toUtf8, + utf8Decoder: fromUtf8, + streamCollector: streamCollector, + requestHandler: new NodeHttpHandler(), + disableHostPrefix: true, +}; +async function handle( + request: __HttpRequest, + context: Context, + operationName: O, + serializer: __OperationSerializer, + operation: __Operation<__OperationInput, __OperationOutput, Context>, + serializeFrameworkException: (e: __SmithyFrameworkException, ctx: __ServerSerdeContext) => Promise<__HttpResponse>, + validationFn: (input: __OperationInput) => __ValidationFailure[], + validationCustomizer: __ValidationCustomizer +): Promise<__HttpResponse> { + let input; + try { + input = await serializer.deserialize(request, { + endpoint: () => Promise.resolve(request), + ...serdeContextBase, + }); + } catch (error: unknown) { + if (__isFrameworkException(error)) { + return serializeFrameworkException(error, serdeContextBase); + } + return serializeFrameworkException(new __SerializationException(), serdeContextBase); + } + try { + const validationFailures = validationFn(input); + if (validationFailures && validationFailures.length > 0) { + const validationException = validationCustomizer({ operation: operationName }, validationFailures); + if (validationException) { + return serializer.serializeError(validationException, serdeContextBase); + } + } + const output = await operation(input, context); + return serializer.serialize(output, serdeContextBase); + } catch (error: unknown) { + if (serializer.isOperationError(error)) { + return serializer.serializeError(error, serdeContextBase); + } + console.log("Received an unexpected error", error); + return serializeFrameworkException(new __InternalFailureException(), serdeContextBase); + } +} +export class OperationWithDefaultsHandler implements __ServiceHandler { + private readonly operation: __Operation; + private readonly mux: __Mux<"RestJson", "OperationWithDefaults">; + private readonly serializer: __OperationSerializer< + RestJsonService, + "OperationWithDefaults", + OperationWithDefaultsErrors + >; + private readonly serializeFrameworkException: ( + e: __SmithyFrameworkException, + ctx: __ServerSerdeContext + ) => Promise<__HttpResponse>; + private readonly validationCustomizer: __ValidationCustomizer<"OperationWithDefaults">; + /** + * Construct a OperationWithDefaults handler. + * @param operation The {@link __Operation} implementation that supplies the business logic for OperationWithDefaults + * @param mux The {@link __Mux} that verifies which service and operation are being invoked by a given {@link __HttpRequest} + * @param serializer An {@link __OperationSerializer} for OperationWithDefaults that + * handles deserialization of requests and serialization of responses + * @param serializeFrameworkException A function that can serialize {@link __SmithyFrameworkException}s + * @param validationCustomizer A {@link __ValidationCustomizer} for turning validation failures into {@link __SmithyFrameworkException}s + */ + constructor( + operation: __Operation, + mux: __Mux<"RestJson", "OperationWithDefaults">, + serializer: __OperationSerializer, "OperationWithDefaults", OperationWithDefaultsErrors>, + serializeFrameworkException: (e: __SmithyFrameworkException, ctx: __ServerSerdeContext) => Promise<__HttpResponse>, + validationCustomizer: __ValidationCustomizer<"OperationWithDefaults"> + ) { + this.operation = operation; + this.mux = mux; + this.serializer = serializer; + this.serializeFrameworkException = serializeFrameworkException; + this.validationCustomizer = validationCustomizer; + } + async handle(request: __HttpRequest, context: Context): Promise<__HttpResponse> { + const target = this.mux.match(request); + if (target === undefined) { + console.log( + "Received a request that did not match aws.protocoltests.restjson#RestJson.OperationWithDefaults. This indicates a misconfiguration." + ); + return this.serializeFrameworkException(new __InternalFailureException(), serdeContextBase); + } + return handle( + request, + context, + "OperationWithDefaults", + this.serializer, + this.operation, + this.serializeFrameworkException, + OperationWithDefaultsServerInput.validate, + this.validationCustomizer + ); + } +} diff --git a/private/aws-restjson-server/src/server/operations/OperationWithNestedStructure.ts b/private/aws-restjson-server/src/server/operations/OperationWithNestedStructure.ts new file mode 100644 index 000000000000..fec9f6acd989 --- /dev/null +++ b/private/aws-restjson-server/src/server/operations/OperationWithNestedStructure.ts @@ -0,0 +1,200 @@ +// smithy-typescript generated code +import { + httpbinding, + InternalFailureException as __InternalFailureException, + isFrameworkException as __isFrameworkException, + Mux as __Mux, + Operation as __Operation, + OperationInput as __OperationInput, + OperationOutput as __OperationOutput, + OperationSerializer as __OperationSerializer, + SerializationException as __SerializationException, + ServerSerdeContext as __ServerSerdeContext, + ServerSerdeContext, + ServiceException as __ServiceException, + ServiceHandler as __ServiceHandler, + SmithyFrameworkException as __SmithyFrameworkException, + ValidationCustomizer as __ValidationCustomizer, + ValidationFailure as __ValidationFailure, +} from "@aws-smithy/server-common"; +import { NodeHttpHandler, streamCollector } from "@smithy/node-http-handler"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http"; +import { fromBase64, toBase64 } from "@smithy/util-base64"; +import { fromUtf8, toUtf8 } from "@smithy/util-utf8"; + +import { OperationWithNestedStructureInput, OperationWithNestedStructureOutput } from "../../models/models_0"; +import { + deserializeOperationWithNestedStructureRequest, + serializeFrameworkException, + serializeOperationWithNestedStructureResponse, +} from "../../protocols/Aws_restJson1"; +import { RestJsonService } from "../RestJsonService"; + +export type OperationWithNestedStructure = __Operation< + OperationWithNestedStructureServerInput, + OperationWithNestedStructureServerOutput, + Context +>; + +export interface OperationWithNestedStructureServerInput extends OperationWithNestedStructureInput {} +export namespace OperationWithNestedStructureServerInput { + /** + * @internal + */ + export const validate: ( + obj: Parameters[0] + ) => __ValidationFailure[] = OperationWithNestedStructureInput.validate; +} +export interface OperationWithNestedStructureServerOutput extends OperationWithNestedStructureOutput {} + +export type OperationWithNestedStructureErrors = never; + +export class OperationWithNestedStructureSerializer + implements + __OperationSerializer, "OperationWithNestedStructure", OperationWithNestedStructureErrors> +{ + serialize = serializeOperationWithNestedStructureResponse; + deserialize = deserializeOperationWithNestedStructureRequest; + + isOperationError(error: any): error is OperationWithNestedStructureErrors { + return false; + } + + serializeError(error: OperationWithNestedStructureErrors, ctx: ServerSerdeContext): Promise<__HttpResponse> { + throw error; + } +} + +export const getOperationWithNestedStructureHandler = ( + operation: __Operation, + customizer: __ValidationCustomizer<"OperationWithNestedStructure"> +): __ServiceHandler => { + const mux = new httpbinding.HttpBindingMux<"RestJson", "OperationWithNestedStructure">([ + new httpbinding.UriSpec<"RestJson", "OperationWithNestedStructure">( + "POST", + [{ type: "path_literal", value: "OperationWithNestedStructure" }], + [], + { service: "RestJson", operation: "OperationWithNestedStructure" } + ), + ]); + return new OperationWithNestedStructureHandler( + operation, + mux, + new OperationWithNestedStructureSerializer(), + serializeFrameworkException, + customizer + ); +}; + +const serdeContextBase = { + base64Encoder: toBase64, + base64Decoder: fromBase64, + utf8Encoder: toUtf8, + utf8Decoder: fromUtf8, + streamCollector: streamCollector, + requestHandler: new NodeHttpHandler(), + disableHostPrefix: true, +}; +async function handle( + request: __HttpRequest, + context: Context, + operationName: O, + serializer: __OperationSerializer, + operation: __Operation<__OperationInput, __OperationOutput, Context>, + serializeFrameworkException: (e: __SmithyFrameworkException, ctx: __ServerSerdeContext) => Promise<__HttpResponse>, + validationFn: (input: __OperationInput) => __ValidationFailure[], + validationCustomizer: __ValidationCustomizer +): Promise<__HttpResponse> { + let input; + try { + input = await serializer.deserialize(request, { + endpoint: () => Promise.resolve(request), + ...serdeContextBase, + }); + } catch (error: unknown) { + if (__isFrameworkException(error)) { + return serializeFrameworkException(error, serdeContextBase); + } + return serializeFrameworkException(new __SerializationException(), serdeContextBase); + } + try { + const validationFailures = validationFn(input); + if (validationFailures && validationFailures.length > 0) { + const validationException = validationCustomizer({ operation: operationName }, validationFailures); + if (validationException) { + return serializer.serializeError(validationException, serdeContextBase); + } + } + const output = await operation(input, context); + return serializer.serialize(output, serdeContextBase); + } catch (error: unknown) { + if (serializer.isOperationError(error)) { + return serializer.serializeError(error, serdeContextBase); + } + console.log("Received an unexpected error", error); + return serializeFrameworkException(new __InternalFailureException(), serdeContextBase); + } +} +export class OperationWithNestedStructureHandler implements __ServiceHandler { + private readonly operation: __Operation< + OperationWithNestedStructureServerInput, + OperationWithNestedStructureServerOutput, + Context + >; + private readonly mux: __Mux<"RestJson", "OperationWithNestedStructure">; + private readonly serializer: __OperationSerializer< + RestJsonService, + "OperationWithNestedStructure", + OperationWithNestedStructureErrors + >; + private readonly serializeFrameworkException: ( + e: __SmithyFrameworkException, + ctx: __ServerSerdeContext + ) => Promise<__HttpResponse>; + private readonly validationCustomizer: __ValidationCustomizer<"OperationWithNestedStructure">; + /** + * Construct a OperationWithNestedStructure handler. + * @param operation The {@link __Operation} implementation that supplies the business logic for OperationWithNestedStructure + * @param mux The {@link __Mux} that verifies which service and operation are being invoked by a given {@link __HttpRequest} + * @param serializer An {@link __OperationSerializer} for OperationWithNestedStructure that + * handles deserialization of requests and serialization of responses + * @param serializeFrameworkException A function that can serialize {@link __SmithyFrameworkException}s + * @param validationCustomizer A {@link __ValidationCustomizer} for turning validation failures into {@link __SmithyFrameworkException}s + */ + constructor( + operation: __Operation, + mux: __Mux<"RestJson", "OperationWithNestedStructure">, + serializer: __OperationSerializer< + RestJsonService, + "OperationWithNestedStructure", + OperationWithNestedStructureErrors + >, + serializeFrameworkException: (e: __SmithyFrameworkException, ctx: __ServerSerdeContext) => Promise<__HttpResponse>, + validationCustomizer: __ValidationCustomizer<"OperationWithNestedStructure"> + ) { + this.operation = operation; + this.mux = mux; + this.serializer = serializer; + this.serializeFrameworkException = serializeFrameworkException; + this.validationCustomizer = validationCustomizer; + } + async handle(request: __HttpRequest, context: Context): Promise<__HttpResponse> { + const target = this.mux.match(request); + if (target === undefined) { + console.log( + "Received a request that did not match aws.protocoltests.restjson#RestJson.OperationWithNestedStructure. This indicates a misconfiguration." + ); + return this.serializeFrameworkException(new __InternalFailureException(), serdeContextBase); + } + return handle( + request, + context, + "OperationWithNestedStructure", + this.serializer, + this.operation, + this.serializeFrameworkException, + OperationWithNestedStructureServerInput.validate, + this.validationCustomizer + ); + } +} diff --git a/private/aws-restjson-server/src/server/operations/TestNoInputNoPayload.ts b/private/aws-restjson-server/src/server/operations/TestNoInputNoPayload.ts new file mode 100644 index 000000000000..0ecbc9d3515a --- /dev/null +++ b/private/aws-restjson-server/src/server/operations/TestNoInputNoPayload.ts @@ -0,0 +1,189 @@ +// smithy-typescript generated code +import { + httpbinding, + InternalFailureException as __InternalFailureException, + isFrameworkException as __isFrameworkException, + Mux as __Mux, + Operation as __Operation, + OperationInput as __OperationInput, + OperationOutput as __OperationOutput, + OperationSerializer as __OperationSerializer, + SerializationException as __SerializationException, + ServerSerdeContext as __ServerSerdeContext, + ServerSerdeContext, + ServiceException as __ServiceException, + ServiceHandler as __ServiceHandler, + SmithyFrameworkException as __SmithyFrameworkException, + ValidationCustomizer as __ValidationCustomizer, + ValidationFailure as __ValidationFailure, +} from "@aws-smithy/server-common"; +import { NodeHttpHandler, streamCollector } from "@smithy/node-http-handler"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http"; +import { fromBase64, toBase64 } from "@smithy/util-base64"; +import { fromUtf8, toUtf8 } from "@smithy/util-utf8"; + +import { TestNoPayloadInputOutput } from "../../models/models_0"; +import { + deserializeTestNoInputNoPayloadRequest, + serializeFrameworkException, + serializeTestNoInputNoPayloadResponse, +} from "../../protocols/Aws_restJson1"; +import { RestJsonService } from "../RestJsonService"; + +export type TestNoInputNoPayload = __Operation< + TestNoInputNoPayloadServerInput, + TestNoInputNoPayloadServerOutput, + Context +>; + +export interface TestNoInputNoPayloadServerInput {} +export namespace TestNoInputNoPayloadServerInput { + /** + * @internal + */ + export const validate: () => __ValidationFailure[] = () => []; +} +export interface TestNoInputNoPayloadServerOutput extends TestNoPayloadInputOutput {} + +export type TestNoInputNoPayloadErrors = never; + +export class TestNoInputNoPayloadSerializer + implements __OperationSerializer, "TestNoInputNoPayload", TestNoInputNoPayloadErrors> +{ + serialize = serializeTestNoInputNoPayloadResponse; + deserialize = deserializeTestNoInputNoPayloadRequest; + + isOperationError(error: any): error is TestNoInputNoPayloadErrors { + return false; + } + + serializeError(error: TestNoInputNoPayloadErrors, ctx: ServerSerdeContext): Promise<__HttpResponse> { + throw error; + } +} + +export const getTestNoInputNoPayloadHandler = ( + operation: __Operation, + customizer: __ValidationCustomizer<"TestNoInputNoPayload"> +): __ServiceHandler => { + const mux = new httpbinding.HttpBindingMux<"RestJson", "TestNoInputNoPayload">([ + new httpbinding.UriSpec<"RestJson", "TestNoInputNoPayload">( + "GET", + [{ type: "path_literal", value: "no_input_no_payload" }], + [], + { service: "RestJson", operation: "TestNoInputNoPayload" } + ), + ]); + return new TestNoInputNoPayloadHandler( + operation, + mux, + new TestNoInputNoPayloadSerializer(), + serializeFrameworkException, + customizer + ); +}; + +const serdeContextBase = { + base64Encoder: toBase64, + base64Decoder: fromBase64, + utf8Encoder: toUtf8, + utf8Decoder: fromUtf8, + streamCollector: streamCollector, + requestHandler: new NodeHttpHandler(), + disableHostPrefix: true, +}; +async function handle( + request: __HttpRequest, + context: Context, + operationName: O, + serializer: __OperationSerializer, + operation: __Operation<__OperationInput, __OperationOutput, Context>, + serializeFrameworkException: (e: __SmithyFrameworkException, ctx: __ServerSerdeContext) => Promise<__HttpResponse>, + validationFn: (input: __OperationInput) => __ValidationFailure[], + validationCustomizer: __ValidationCustomizer +): Promise<__HttpResponse> { + let input; + try { + input = await serializer.deserialize(request, { + endpoint: () => Promise.resolve(request), + ...serdeContextBase, + }); + } catch (error: unknown) { + if (__isFrameworkException(error)) { + return serializeFrameworkException(error, serdeContextBase); + } + return serializeFrameworkException(new __SerializationException(), serdeContextBase); + } + try { + const validationFailures = validationFn(input); + if (validationFailures && validationFailures.length > 0) { + const validationException = validationCustomizer({ operation: operationName }, validationFailures); + if (validationException) { + return serializer.serializeError(validationException, serdeContextBase); + } + } + const output = await operation(input, context); + return serializer.serialize(output, serdeContextBase); + } catch (error: unknown) { + if (serializer.isOperationError(error)) { + return serializer.serializeError(error, serdeContextBase); + } + console.log("Received an unexpected error", error); + return serializeFrameworkException(new __InternalFailureException(), serdeContextBase); + } +} +export class TestNoInputNoPayloadHandler implements __ServiceHandler { + private readonly operation: __Operation; + private readonly mux: __Mux<"RestJson", "TestNoInputNoPayload">; + private readonly serializer: __OperationSerializer< + RestJsonService, + "TestNoInputNoPayload", + TestNoInputNoPayloadErrors + >; + private readonly serializeFrameworkException: ( + e: __SmithyFrameworkException, + ctx: __ServerSerdeContext + ) => Promise<__HttpResponse>; + private readonly validationCustomizer: __ValidationCustomizer<"TestNoInputNoPayload">; + /** + * Construct a TestNoInputNoPayload handler. + * @param operation The {@link __Operation} implementation that supplies the business logic for TestNoInputNoPayload + * @param mux The {@link __Mux} that verifies which service and operation are being invoked by a given {@link __HttpRequest} + * @param serializer An {@link __OperationSerializer} for TestNoInputNoPayload that + * handles deserialization of requests and serialization of responses + * @param serializeFrameworkException A function that can serialize {@link __SmithyFrameworkException}s + * @param validationCustomizer A {@link __ValidationCustomizer} for turning validation failures into {@link __SmithyFrameworkException}s + */ + constructor( + operation: __Operation, + mux: __Mux<"RestJson", "TestNoInputNoPayload">, + serializer: __OperationSerializer, "TestNoInputNoPayload", TestNoInputNoPayloadErrors>, + serializeFrameworkException: (e: __SmithyFrameworkException, ctx: __ServerSerdeContext) => Promise<__HttpResponse>, + validationCustomizer: __ValidationCustomizer<"TestNoInputNoPayload"> + ) { + this.operation = operation; + this.mux = mux; + this.serializer = serializer; + this.serializeFrameworkException = serializeFrameworkException; + this.validationCustomizer = validationCustomizer; + } + async handle(request: __HttpRequest, context: Context): Promise<__HttpResponse> { + const target = this.mux.match(request); + if (target === undefined) { + console.log( + "Received a request that did not match aws.protocoltests.restjson#RestJson.TestNoInputNoPayload. This indicates a misconfiguration." + ); + return this.serializeFrameworkException(new __InternalFailureException(), serdeContextBase); + } + return handle( + request, + context, + "TestNoInputNoPayload", + this.serializer, + this.operation, + this.serializeFrameworkException, + TestNoInputNoPayloadServerInput.validate, + this.validationCustomizer + ); + } +} diff --git a/private/aws-restjson-server/src/server/operations/index.ts b/private/aws-restjson-server/src/server/operations/index.ts index 4b42303ae594..3c1b4baec505 100644 --- a/private/aws-restjson-server/src/server/operations/index.ts +++ b/private/aws-restjson-server/src/server/operations/index.ts @@ -2,6 +2,7 @@ export * from "./AllQueryStringTypes"; export * from "./ConstantAndVariableQueryString"; export * from "./ConstantQueryString"; +export * from "./ContentTypeParameters"; export * from "./DatetimeOffsets"; export * from "./DocumentType"; export * from "./DocumentTypeAsMapValue"; @@ -75,6 +76,8 @@ export * from "./NullAndEmptyHeadersClient"; export * from "./NullAndEmptyHeadersServer"; export * from "./OmitsNullSerializesEmptyString"; export * from "./OmitsSerializingEmptyLists"; +export * from "./OperationWithDefaults"; +export * from "./OperationWithNestedStructure"; export * from "./PostPlayerAction"; export * from "./PostUnionWithJsonName"; export * from "./PutWithContentEncoding"; @@ -89,6 +92,7 @@ export * from "./StreamingTraits"; export * from "./StreamingTraitsRequireLength"; export * from "./StreamingTraitsWithMediaType"; export * from "./TestBodyStructure"; +export * from "./TestNoInputNoPayload"; export * from "./TestNoPayload"; export * from "./TestPayloadBlob"; export * from "./TestPayloadStructure"; diff --git a/private/aws-restjson-server/test/functional/restjson1.spec.ts b/private/aws-restjson-server/test/functional/restjson1.spec.ts index 0e49a469eefa..64e3c8fdc8e6 100644 --- a/private/aws-restjson-server/test/functional/restjson1.spec.ts +++ b/private/aws-restjson-server/test/functional/restjson1.spec.ts @@ -19,6 +19,7 @@ import { getRestJsonServiceHandler } from "../../src/server"; import { AllQueryStringTypes } from "../../src/server/operations/AllQueryStringTypes"; import { ConstantAndVariableQueryString } from "../../src/server/operations/ConstantAndVariableQueryString"; import { ConstantQueryString } from "../../src/server/operations/ConstantQueryString"; +import { ContentTypeParameters } from "../../src/server/operations/ContentTypeParameters"; import { DocumentType, DocumentTypeSerializer, @@ -166,6 +167,16 @@ import { NullAndEmptyHeadersServerServerOutput, } from "../../src/server/operations/NullAndEmptyHeadersServer"; import { OmitsNullSerializesEmptyString } from "../../src/server/operations/OmitsNullSerializesEmptyString"; +import { + OperationWithDefaults, + OperationWithDefaultsSerializer, + OperationWithDefaultsServerOutput, +} from "../../src/server/operations/OperationWithDefaults"; +import { + OperationWithNestedStructure, + OperationWithNestedStructureSerializer, + OperationWithNestedStructureServerOutput, +} from "../../src/server/operations/OperationWithNestedStructure"; import { PostPlayerAction, PostPlayerActionSerializer, @@ -211,6 +222,7 @@ import { StreamingTraitsWithMediaTypeServerOutput, } from "../../src/server/operations/StreamingTraitsWithMediaType"; import { TestBodyStructure } from "../../src/server/operations/TestBodyStructure"; +import { TestNoInputNoPayload } from "../../src/server/operations/TestNoInputNoPayload"; import { TestNoPayload } from "../../src/server/operations/TestNoPayload"; import { TestPayloadBlob } from "../../src/server/operations/TestPayloadBlob"; import { TestPayloadStructure } from "../../src/server/operations/TestPayloadStructure"; @@ -983,6 +995,50 @@ it("RestJsonConstantQueryString:ServerRequest", async () => { }); }); +/** + * A server should ignore parameters added to the content type + */ +it.skip("RestJsonMustSupportParametersInContentType:ServerRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockReturnValue(Promise.resolve({})); + const testService: Partial> = { + ContentTypeParameters: testFunction as ContentTypeParameters<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "POST", + hostname: "foo.example.com", + path: "/ContentTypeParameters", + query: {}, + headers: { + "content-type": "application/json; charset=utf-8", + }, + body: Readable.from(['{"value":5}']), + }); + await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(1); + const r: any = testFunction.mock.calls[0][0]; + + const paramsToValidate: any = [ + { + value: 5, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + /** * Serializes document types as part of the JSON request payload with no escaping. */ @@ -2406,7 +2462,9 @@ it("RestJsonEnumPayloadRequest:ServerRequest", async () => { hostname: "foo.example.com", path: "/EnumPayload", query: {}, - headers: {}, + headers: { + "content-type": "text/plain", + }, body: Readable.from(["enumvalue"]), }); await handler.handle(request, {}); @@ -2468,6 +2526,9 @@ it("RestJsonEnumPayloadResponse:ServerResponse", async () => { expect(r.statusCode).toBe(200); + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("text/plain"); + expect(r.body).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `enumvalue`; @@ -2614,6 +2675,53 @@ it("RestJsonHttpPayloadTraitsWithBlobAcceptsAllContentTypes:ServerRequest", asyn }); }); +/** + * Servers must accept no content type for blob inputs + * without the media type trait. + */ +it("RestJsonHttpPayloadTraitsWithBlobAcceptsNoContentType:ServerRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockReturnValue(Promise.resolve({})); + const testService: Partial> = { + HttpPayloadTraits: testFunction as HttpPayloadTraits<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "POST", + hostname: "foo.example.com", + path: "/HttpPayloadTraits", + query: {}, + headers: { + "x-foo": "Foo", + }, + body: Readable.from(["This is definitely a jpeg"]), + }); + await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(1); + const r: any = testFunction.mock.calls[0][0]; + + const paramsToValidate: any = [ + { + foo: "Foo", + + blob: Uint8Array.from("This is definitely a jpeg", (c) => c.charCodeAt(0)), + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + /** * Servers must accept any accept header for blob inputs * without the media type trait. @@ -3867,7 +3975,9 @@ it("RestJsonStringPayloadRequest:ServerRequest", async () => { hostname: "foo.example.com", path: "/StringPayload", query: {}, - headers: {}, + headers: { + "content-type": "text/plain", + }, body: Readable.from(["rawstring"]), }); await handler.handle(request, {}); @@ -3929,13 +4039,129 @@ it("RestJsonStringPayloadResponse:ServerResponse", async () => { expect(r.statusCode).toBe(200); + expect(r.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("text/plain"); + expect(r.body).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `rawstring`; - const unequalParts: any = compareEquivalentUnknownTypeBodies(utf8Encoder, bodyString, r.body); + const unequalParts: any = compareEquivalentTextBodies(bodyString, r.body); expect(unequalParts).toBeUndefined(); }); +/** + * Serializes a string in the HTTP payload without a content-type header + */ +it.skip("RestJsonStringPayloadNoContentType:MalformedRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockImplementation(() => { + throw new Error("This request should have been rejected."); + }); + const testService: Partial> = { + HttpStringPayload: testFunction as HttpStringPayload<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "POST", + hostname: "foo.example.com", + path: "/StringPayload", + query: {}, + headers: {}, + body: Readable.from(["rawstring"]), + }); + const r = await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(0); + expect(r.statusCode).toBe(415); + expect(r.headers["x-amzn-errortype"]).toBeDefined(); + expect(r.headers["x-amzn-errortype"]).toBe("UnsupportedMediaTypeException"); +}); + +/** + * Serializes a string in the HTTP payload without the expected content-type header + */ +it("RestJsonStringPayloadWrongContentType:MalformedRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockImplementation(() => { + throw new Error("This request should have been rejected."); + }); + const testService: Partial> = { + HttpStringPayload: testFunction as HttpStringPayload<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "POST", + hostname: "foo.example.com", + path: "/StringPayload", + query: {}, + headers: { + "content-type": "application/json", + }, + body: Readable.from(["rawstring"]), + }); + const r = await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(0); + expect(r.statusCode).toBe(415); + expect(r.headers["x-amzn-errortype"]).toBeDefined(); + expect(r.headers["x-amzn-errortype"]).toBe("UnsupportedMediaTypeException"); +}); + +/** + * Serializes a string in the HTTP payload with an unstatisfiable accept header + */ +it("RestJsonStringPayloadUnsatisfiableAccept:MalformedRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockImplementation(() => { + throw new Error("This request should have been rejected."); + }); + const testService: Partial> = { + HttpStringPayload: testFunction as HttpStringPayload<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "POST", + hostname: "foo.example.com", + path: "/StringPayload", + query: {}, + headers: { + "content-type": "text/plain", + accept: "application/json", + }, + body: Readable.from(["rawstring"]), + }); + const r = await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(0); + expect(r.statusCode).toBe(406); + expect(r.headers["x-amzn-errortype"]).toBeDefined(); + expect(r.headers["x-amzn-errortype"]).toBe("NotAcceptableException"); +}); + /** * Query parameters must be ignored when serializing the output * of an operation. As of January 2021, server implementations @@ -14454,7 +14680,7 @@ it("RestJsonHeaderByteMalformedValueRejected_case6:MalformedRequest", async () = }); /** - * When there is modeled input, they content type must be application/json + * When there is modeled input, the content type must be application/json */ it("RestJsonWithBodyExpectsApplicationJsonContentType:MalformedRequest", async () => { const testFunction = jest.fn(); @@ -14491,6 +14717,42 @@ it("RestJsonWithBodyExpectsApplicationJsonContentType:MalformedRequest", async ( expect(r.headers["x-amzn-errortype"]).toBe("UnsupportedMediaTypeException"); }); +/** + * When there is modeled input, the content type must be application/json + */ +it.skip("RestJsonWithBodyExpectsApplicationJsonContentTypeNoHeaders:MalformedRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockImplementation(() => { + throw new Error("This request should have been rejected."); + }); + const testService: Partial> = { + MalformedContentTypeWithBody: testFunction as MalformedContentTypeWithBody<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "POST", + hostname: "foo.example.com", + path: "/MalformedContentTypeWithBody", + query: {}, + headers: {}, + body: Readable.from(["{}"]), + }); + const r = await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(0); + expect(r.statusCode).toBe(415); + expect(r.headers["x-amzn-errortype"]).toBeDefined(); + expect(r.headers["x-amzn-errortype"]).toBe("UnsupportedMediaTypeException"); +}); + /** * When there is no modeled input, content type must not be set and the body must be empty. */ @@ -27374,10 +27636,10 @@ it("RestJsonMalformedUnionNoFieldsSet:MalformedRequest", async () => { }); /** - * When the union value is actually an array, the response should be a 400 - * SerializationException. + * When the union is an empty object, it has no fields set, so the + * response should be a 400 SerializationException. */ -it("RestJsonMalformedUnionValueIsArray:MalformedRequest", async () => { +it("RestJsonMalformedUnionEmptyObjectNoFieldsSet:MalformedRequest", async () => { const testFunction = jest.fn(); testFunction.mockImplementation(() => { throw new Error("This request should have been rejected."); @@ -27402,7 +27664,7 @@ it("RestJsonMalformedUnionValueIsArray:MalformedRequest", async () => { headers: { "content-type": "application/json", }, - body: Readable.from(['{ "union" : ["int"] }']), + body: Readable.from(['{ "union" : { } }']), }); const r = await handler.handle(request, {}); @@ -27413,10 +27675,10 @@ it("RestJsonMalformedUnionValueIsArray:MalformedRequest", async () => { }); /** - * When an unknown union member is received, the response should be a 400 + * When the union value is actually an array, the response should be a 400 * SerializationException. */ -it.skip("RestJsonMalformedUnionUnknownMember:MalformedRequest", async () => { +it("RestJsonMalformedUnionValueIsArray:MalformedRequest", async () => { const testFunction = jest.fn(); testFunction.mockImplementation(() => { throw new Error("This request should have been rejected."); @@ -27441,7 +27703,7 @@ it.skip("RestJsonMalformedUnionUnknownMember:MalformedRequest", async () => { headers: { "content-type": "application/json", }, - body: Readable.from(['{\n "union": {\n "unknown": "hello"\n }\n}']), + body: Readable.from(['{ "union" : ["int"] }']), }); const r = await handler.handle(request, {}); @@ -27452,11 +27714,50 @@ it.skip("RestJsonMalformedUnionUnknownMember:MalformedRequest", async () => { }); /** - * Headers that target strings with a mediaType are base64 encoded + * When an unknown union member is received, the response should be a 400 + * SerializationException. */ -it("MediaTypeHeaderInputBase64:ServerRequest", async () => { +it.skip("RestJsonMalformedUnionUnknownMember:MalformedRequest", async () => { const testFunction = jest.fn(); - testFunction.mockReturnValue(Promise.resolve({})); + testFunction.mockImplementation(() => { + throw new Error("This request should have been rejected."); + }); + const testService: Partial> = { + MalformedUnion: testFunction as MalformedUnion<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "POST", + hostname: "foo.example.com", + path: "/MalformedUnion", + query: {}, + headers: { + "content-type": "application/json", + }, + body: Readable.from(['{\n "union": {\n "unknown": "hello"\n }\n}']), + }); + const r = await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(0); + expect(r.statusCode).toBe(400); + expect(r.headers["x-amzn-errortype"]).toBeDefined(); + expect(r.headers["x-amzn-errortype"]).toBe("SerializationException"); +}); + +/** + * Headers that target strings with a mediaType are base64 encoded + */ +it("MediaTypeHeaderInputBase64:ServerRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockReturnValue(Promise.resolve({})); const testService: Partial> = { MediaTypeHeader: testFunction as MediaTypeHeader<{}>, }; @@ -27929,6 +28230,425 @@ it("RestJsonServersAcceptStaticQueryParamAsEmptyString:ServerRequest", async () }); }); +/** + * Server populates default values when missing in request body. + */ +it.skip("RestJsonServerPopulatesDefaultsWhenMissingInRequestBody:ServerRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockReturnValue(Promise.resolve({})); + const testService: Partial> = { + OperationWithDefaults: testFunction as OperationWithDefaults<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "POST", + hostname: "foo.example.com", + path: "/OperationWithDefaults", + query: {}, + headers: { + "content-type": "application/json", + }, + body: Readable.from(['{\n"defaults": {}\n}']), + }); + await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(1); + const r: any = testFunction.mock.calls[0][0]; + + const paramsToValidate: any = [ + { + defaults: { + defaultString: "hi", + + defaultBoolean: true, + + defaultList: [], + + defaultDocumentMap: {}, + + defaultDocumentString: "hi", + + defaultDocumentBoolean: true, + + defaultDocumentList: [], + + defaultTimestamp: new Date(0 * 1000), + + defaultBlob: Uint8Array.from("abc", (c) => c.charCodeAt(0)), + + defaultByte: 1, + + defaultShort: 1, + + defaultInteger: 10, + + defaultLong: 100, + + defaultFloat: 1.0, + + defaultDouble: 1.0, + + defaultMap: {}, + + defaultEnum: "FOO", + + defaultIntEnum: 1, + + emptyString: "", + + falseBoolean: false, + + emptyBlob: Uint8Array.from("", (c) => c.charCodeAt(0)), + + zeroByte: 0, + + zeroShort: 0, + + zeroInteger: 0, + + zeroLong: 0, + + zeroFloat: 0.0, + + zeroDouble: 0.0, + }, + + topLevelDefault: "hi", + + otherTopLevelDefault: 0, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Server populates default values in response when missing in params. + */ +it.skip("RestJsonServerPopulatesDefaultsInResponseWhenMissingInParams:ServerResponse", async () => { + class TestService implements Partial> { + OperationWithDefaults(input: any, ctx: {}): Promise { + const response = {} as any; + return Promise.resolve({ ...response, $metadata: {} }); + } + } + const service: any = new TestService(); + const testMux = new httpbinding.HttpBindingMux<"RestJson", keyof RestJsonService<{}>>([ + new httpbinding.UriSpec<"RestJson", "OperationWithDefaults">("POST", [], [], { + service: "RestJson", + operation: "OperationWithDefaults", + }), + ]); + class TestSerializer extends OperationWithDefaultsSerializer { + 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.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).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 + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); +}); + +/** + * Server populates nested default values when missing in request body. + */ +it.skip("RestJsonServerPopulatesNestedDefaultsWhenMissingInRequestBody:ServerRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockReturnValue(Promise.resolve({})); + const testService: Partial> = { + OperationWithNestedStructure: testFunction as OperationWithNestedStructure<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "POST", + hostname: "foo.example.com", + path: "/OperationWithNestedStructure", + query: {}, + headers: { + "content-type": "application/json", + }, + body: Readable.from([ + '{\n "topLevel": {\n "dialog": {\n "language": "en"\n },\n "dialogList": [\n {\n },\n {\n "farewell": {}\n },\n {\n "language": "it",\n "greeting": "ciao",\n "farewell": {\n "phrase": "arrivederci"\n }\n }\n ],\n "dialogMap": {\n "emptyDialog": {\n },\n "partialEmptyDialog": {\n "language": "en",\n "farewell": {}\n },\n "nonEmptyDialog": {\n "greeting": "konnichiwa",\n "farewell": {\n "phrase": "sayonara"\n }\n }\n }\n }\n}', + ]), + }); + await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(1); + const r: any = testFunction.mock.calls[0][0]; + + const paramsToValidate: any = [ + { + topLevel: { + 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", + }, + }, + }, + }, + }, + ][0]; + Object.keys(paramsToValidate).forEach((param) => { + expect(r[param]).toBeDefined(); + expect(equivalentContents(r[param], paramsToValidate[param])).toBe(true); + }); +}); + +/** + * Server populates nested default values when missing in response params. + */ +it.skip("RestJsonServerPopulatesNestedDefaultValuesWhenMissingInInResponseParams:ServerResponse", async () => { + class TestService implements Partial> { + OperationWithNestedStructure(input: any, ctx: {}): Promise { + const response = { + dialog: { + language: "en", + } as any, + + dialogList: [ + {} as any, + + { + farewell: {} as any, + } as any, + + { + language: "it", + + greeting: "ciao", + + farewell: { + phrase: "arrivederci", + } as any, + } as any, + ], + + dialogMap: { + emptyDialog: {} as any, + + partialEmptyDialog: { + language: "en", + + farewell: {} as any, + } as any, + + nonEmptyDialog: { + greeting: "konnichiwa", + + farewell: { + phrase: "sayonara", + } as any, + } as any, + } as any, + } as any; + return Promise.resolve({ ...response, $metadata: {} }); + } + } + const service: any = new TestService(); + const testMux = new httpbinding.HttpBindingMux<"RestJson", keyof RestJsonService<{}>>([ + new httpbinding.UriSpec<"RestJson", "OperationWithNestedStructure">("POST", [], [], { + service: "RestJson", + operation: "OperationWithNestedStructure", + }), + ]); + class TestSerializer extends OperationWithNestedStructureSerializer { + 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.headers["content-type"]).toBeDefined(); + expect(r.headers["content-type"]).toBe("application/json"); + + expect(r.body).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\" + } + } + } + }`; + const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); + expect(unequalParts).toBeUndefined(); +}); + /** * Unit types in unions are serialized like normal structures in requests. */ @@ -28029,10 +28749,10 @@ it("RestJsonOutputUnionWithUnitMember:ServerResponse", async () => { expect(r.body).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"action\": { - \"quit\": {} - } - }`; + \"action\": { + \"quit\": {} + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28229,10 +28949,10 @@ it("PostUnionWithJsonNameResponse1:ServerResponse", async () => { expect(r.body).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"value\": { - \"FOO\": \"hi\" - } - }`; + \"value\": { + \"FOO\": \"hi\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28291,10 +29011,10 @@ it("PostUnionWithJsonNameResponse2:ServerResponse", async () => { expect(r.body).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"value\": { - \"_baz\": \"hi\" - } - }`; + \"value\": { + \"_baz\": \"hi\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28353,10 +29073,10 @@ it("PostUnionWithJsonNameResponse3:ServerResponse", async () => { expect(r.body).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"value\": { - \"bar\": \"hi\" - } - }`; + \"value\": { + \"bar\": \"hi\" + } + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -28680,19 +29400,19 @@ it("RestJsonRecursiveShapes:ServerResponse", async () => { expect(r.body).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"nested\": { - \"foo\": \"Foo1\", \"nested\": { - \"bar\": \"Bar1\", - \"recursiveMember\": { - \"foo\": \"Foo2\", - \"nested\": { - \"bar\": \"Bar2\" + \"foo\": \"Foo1\", + \"nested\": { + \"bar\": \"Bar1\", + \"recursiveMember\": { + \"foo\": \"Foo2\", + \"nested\": { + \"bar\": \"Bar2\" + } } } } - } - }`; + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -29006,16 +29726,16 @@ it("RestJsonSimpleScalarProperties:ServerResponse", async () => { expect(r.body).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(); }); @@ -29130,9 +29850,9 @@ it("RestJsonSupportsNaNFloatInputs:ServerResponse", async () => { expect(r.body).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(); }); @@ -29191,9 +29911,9 @@ it("RestJsonSupportsInfinityFloatInputs:ServerResponse", async () => { expect(r.body).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(); }); @@ -29252,9 +29972,9 @@ it("RestJsonSupportsNegativeInfinityFloatInputs:ServerResponse", async () => { expect(r.body).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(); }); @@ -29355,11 +30075,11 @@ it("RestJsonSparseListsSerializeNull:ServerResponse", async () => { expect(r.body).toBeDefined(); const utf8Encoder = __utf8Encoder; const bodyString = `{ - \"sparseStringList\": [ - null, - \"hi\" - ] - }`; + \"sparseStringList\": [ + null, + \"hi\" + ] + }`; const unequalParts: any = compareEquivalentJsonBodies(bodyString, r.body.toString()); expect(unequalParts).toBeUndefined(); }); @@ -29690,15 +30410,15 @@ it("RestJsonSparseJsonMaps:ServerResponse", async () => { expect(r.body).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(); }); @@ -29769,19 +30489,19 @@ it("RestJsonDeserializesSparseNullMapValues:ServerResponse", async () => { expect(r.body).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(); }); @@ -29844,13 +30564,13 @@ it("RestJsonDeserializesZeroValuesInSparseMaps:ServerResponse", async () => { expect(r.body).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(); }); @@ -29911,11 +30631,11 @@ it("RestJsonDeserializesSparseSetMap:ServerResponse", async () => { expect(r.body).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(); }); @@ -29978,12 +30698,12 @@ it("RestJsonDeserializesSparseSetMapAndRetainsNull:ServerResponse", async () => expect(r.body).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(); }); @@ -30494,6 +31214,38 @@ it("RestJsonHttpWithEmptyBody:ServerRequest", async () => { const r: any = testFunction.mock.calls[0][0]; }); +/** + * Serializes a GET request for an operation with no input, and therefore no modeled body + */ +it("RestJsonHttpWithNoInput:ServerRequest", async () => { + const testFunction = jest.fn(); + testFunction.mockReturnValue(Promise.resolve({})); + const testService: Partial> = { + TestNoInputNoPayload: testFunction as TestNoInputNoPayload<{}>, + }; + const handler = getRestJsonServiceHandler( + testService as RestJsonService<{}>, + (ctx: {}, failures: __ValidationFailure[]) => { + if (failures) { + throw failures; + } + return undefined; + } + ); + const request = new HttpRequest({ + method: "GET", + hostname: "foo.example.com", + path: "/no_input_no_payload", + query: {}, + headers: {}, + body: Readable.from([""]), + }); + await handler.handle(request, {}); + + expect(testFunction.mock.calls.length).toBe(1); + const r: any = testFunction.mock.calls[0][0]; +}); + /** * Serializes a GET request with no modeled body */ @@ -31054,6 +31806,17 @@ const compareEquivalentOctetStreamBodies = ( return compareParts(expectedParts, generatedParts); }; +/** + * Returns a map of key names that were un-equal to value objects showing the + * discrepancies between the components. + */ +const compareEquivalentTextBodies = (expectedBody: string, generatedBody: string): Object => { + const expectedParts = { Value: expectedBody }; + const generatedParts = { Value: generatedBody }; + + return compareParts(expectedParts, generatedParts); +}; + /** * Returns a map of key names that were un-equal to value objects showing the * discrepancies between the components. diff --git a/scripts/generate-clients/config.js b/scripts/generate-clients/config.js index 12c4cf89967f..085d948cad31 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: "d952a6a9d6a436b79f6174fcee9e4fbed82ca841", + SMITHY_TS_COMMIT: "865480461197c7913c7fe258ff37d77ef6227e5c", }; if (module.exports.SMITHY_TS_COMMIT.length < 40) {