Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump smithy to 1.14.x #3053

Merged
merged 6 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ allprojects {
version = "0.7.0"
}

extra["smithyVersion"] = "[1.12.0,1.13.0["
extra["smithyVersion"] = "[1.14.0,1.15.0["

// The root project doesn't produce a JAR.
tasks["jar"].enabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ private static boolean filterProtocolTests(
if (testCase.getId().equals("RestJsonNoInputAndOutput")) {
return true;
}
// TODO: Remove when server protocol tests are fixed in
// https://github.com/aws/aws-sdk-js-v3/issues/3058
// TODO: Move to filter specific to server protocol tests if added in
// https://github.com/awslabs/smithy-typescript/issues/470
if (testCase.getId().equals("RestJsonTestPayloadStructure")
|| testCase.getId().equals("RestJsonHttpWithHeadersButNoPayload")) {
return true;
}
return false;
}

Expand Down Expand Up @@ -331,11 +339,6 @@ private static boolean filterMalformedRequestTests(
if (testCase.getId().equals("RestJsonMalformedPatternReDOSString")) {
return true;
}
//TODO: broken in Smithy 1.12.0, remove after next Smithy release
if (testCase.getId().equals("RestJsonMalformedLengthBlobOverride_case1")
|| testCase.getId().equals("RestJsonMalformedRequiredQueryNoValue")) {
return true;
}

return false;
}
Expand Down
169 changes: 169 additions & 0 deletions private/aws-protocoltests-restjson/src/RestJsonProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,26 @@ import {
StreamingTraitsWithMediaTypeCommandInput,
StreamingTraitsWithMediaTypeCommandOutput,
} from "./commands/StreamingTraitsWithMediaTypeCommand";
import {
TestBodyStructureCommand,
TestBodyStructureCommandInput,
TestBodyStructureCommandOutput,
} from "./commands/TestBodyStructureCommand";
import {
TestNoPayloadCommand,
TestNoPayloadCommandInput,
TestNoPayloadCommandOutput,
} from "./commands/TestNoPayloadCommand";
import {
TestPayloadBlobCommand,
TestPayloadBlobCommandInput,
TestPayloadBlobCommandOutput,
} from "./commands/TestPayloadBlobCommand";
import {
TestPayloadStructureCommand,
TestPayloadStructureCommandInput,
TestPayloadStructureCommandOutput,
} from "./commands/TestPayloadStructureCommand";
import {
TimestampFormatHeadersCommand,
TimestampFormatHeadersCommandInput,
Expand Down Expand Up @@ -2762,6 +2782,155 @@ export class RestJsonProtocol extends RestJsonProtocolClient {
}
}

/**
* This example operation serializes a structure in the HTTP body.
*
* It should ensure Content-Type: application/json is
* used in all requests and that an "empty" body is
* an empty JSON document ({}).
*
*/
public testBodyStructure(
args: TestBodyStructureCommandInput,
options?: __HttpHandlerOptions
): Promise<TestBodyStructureCommandOutput>;
public testBodyStructure(
args: TestBodyStructureCommandInput,
cb: (err: any, data?: TestBodyStructureCommandOutput) => void
): void;
public testBodyStructure(
args: TestBodyStructureCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: TestBodyStructureCommandOutput) => void
): void;
public testBodyStructure(
args: TestBodyStructureCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TestBodyStructureCommandOutput) => void),
cb?: (err: any, data?: TestBodyStructureCommandOutput) => void
): Promise<TestBodyStructureCommandOutput> | void {
const command = new TestBodyStructureCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* This example operation 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.
*
*/
public testNoPayload(
args: TestNoPayloadCommandInput,
options?: __HttpHandlerOptions
): Promise<TestNoPayloadCommandOutput>;
public testNoPayload(
args: TestNoPayloadCommandInput,
cb: (err: any, data?: TestNoPayloadCommandOutput) => void
): void;
public testNoPayload(
args: TestNoPayloadCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: TestNoPayloadCommandOutput) => void
): void;
public testNoPayload(
args: TestNoPayloadCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TestNoPayloadCommandOutput) => void),
cb?: (err: any, data?: TestNoPayloadCommandOutput) => void
): Promise<TestNoPayloadCommandOutput> | void {
const command = new TestNoPayloadCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* This example operation serializes a payload targeting a blob.
*
* The Blob shape is not structured content and we cannot
* make assumptions about what data will be sent. This test ensures
* only a generic "Content-Type: application/octet-stream" header
* is used, and that we are not treating an empty body as an
* empty JSON document.
*
*/
public testPayloadBlob(
args: TestPayloadBlobCommandInput,
options?: __HttpHandlerOptions
): Promise<TestPayloadBlobCommandOutput>;
public testPayloadBlob(
args: TestPayloadBlobCommandInput,
cb: (err: any, data?: TestPayloadBlobCommandOutput) => void
): void;
public testPayloadBlob(
args: TestPayloadBlobCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: TestPayloadBlobCommandOutput) => void
): void;
public testPayloadBlob(
args: TestPayloadBlobCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TestPayloadBlobCommandOutput) => void),
cb?: (err: any, data?: TestPayloadBlobCommandOutput) => void
): Promise<TestPayloadBlobCommandOutput> | void {
const command = new TestPayloadBlobCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* This example operation serializes a payload targeting a structure.
*
* This enforces the same requirements as TestBodyStructure
* but with the body specified by the @httpPayload trait.
*
*/
public testPayloadStructure(
args: TestPayloadStructureCommandInput,
options?: __HttpHandlerOptions
): Promise<TestPayloadStructureCommandOutput>;
public testPayloadStructure(
args: TestPayloadStructureCommandInput,
cb: (err: any, data?: TestPayloadStructureCommandOutput) => void
): void;
public testPayloadStructure(
args: TestPayloadStructureCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: TestPayloadStructureCommandOutput) => void
): void;
public testPayloadStructure(
args: TestPayloadStructureCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TestPayloadStructureCommandOutput) => void),
cb?: (err: any, data?: TestPayloadStructureCommandOutput) => void
): Promise<TestPayloadStructureCommandOutput> | void {
const command = new TestPayloadStructureCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* This example tests how timestamp request and response headers are serialized.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,13 @@ import {
StreamingTraitsWithMediaTypeCommandInput,
StreamingTraitsWithMediaTypeCommandOutput,
} from "./commands/StreamingTraitsWithMediaTypeCommand";
import { TestBodyStructureCommandInput, TestBodyStructureCommandOutput } from "./commands/TestBodyStructureCommand";
import { TestNoPayloadCommandInput, TestNoPayloadCommandOutput } from "./commands/TestNoPayloadCommand";
import { TestPayloadBlobCommandInput, TestPayloadBlobCommandOutput } from "./commands/TestPayloadBlobCommand";
import {
TestPayloadStructureCommandInput,
TestPayloadStructureCommandOutput,
} from "./commands/TestPayloadStructureCommand";
import {
TimestampFormatHeadersCommandInput,
TimestampFormatHeadersCommandOutput,
Expand Down Expand Up @@ -342,6 +349,10 @@ export type ServiceInputTypes =
| StreamingTraitsCommandInput
| StreamingTraitsRequireLengthCommandInput
| StreamingTraitsWithMediaTypeCommandInput
| TestBodyStructureCommandInput
| TestNoPayloadCommandInput
| TestPayloadBlobCommandInput
| TestPayloadStructureCommandInput
| TimestampFormatHeadersCommandInput;

export type ServiceOutputTypes =
Expand Down Expand Up @@ -423,6 +434,10 @@ export type ServiceOutputTypes =
| StreamingTraitsCommandOutput
| StreamingTraitsRequireLengthCommandOutput
| StreamingTraitsWithMediaTypeCommandOutput
| TestBodyStructureCommandOutput
| TestNoPayloadCommandOutput
| TestPayloadBlobCommandOutput
| TestPayloadStructureCommandOutput
| TimestampFormatHeadersCommandOutput;

export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { TestBodyStructureInputOutput } from "../models/models_0";
import {
deserializeAws_restJson1TestBodyStructureCommand,
serializeAws_restJson1TestBodyStructureCommand,
} from "../protocols/Aws_restJson1";
import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient";

export interface TestBodyStructureCommandInput extends TestBodyStructureInputOutput {}
export interface TestBodyStructureCommandOutput extends TestBodyStructureInputOutput, __MetadataBearer {}

/**
* This example operation serializes a structure in the HTTP body.
*
* It should ensure Content-Type: application/json is
* used in all requests and that an "empty" body is
* an empty JSON document ({}).
*
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { RestJsonProtocolClient, TestBodyStructureCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import
* // const { RestJsonProtocolClient, TestBodyStructureCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import
* const client = new RestJsonProtocolClient(config);
* const command = new TestBodyStructureCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link TestBodyStructureCommandInput} for command's `input` shape.
* @see {@link TestBodyStructureCommandOutput} for command's `response` shape.
* @see {@link RestJsonProtocolClientResolvedConfig | config} for RestJsonProtocolClient's `config` shape.
*
*/
export class TestBodyStructureCommand extends $Command<
TestBodyStructureCommandInput,
TestBodyStructureCommandOutput,
RestJsonProtocolClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: TestBodyStructureCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: RestJsonProtocolClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<TestBodyStructureCommandInput, TestBodyStructureCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "RestJsonProtocolClient";
const commandName = "TestBodyStructureCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: TestBodyStructureInputOutput.filterSensitiveLog,
outputFilterSensitiveLog: TestBodyStructureInputOutput.filterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: TestBodyStructureCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_restJson1TestBodyStructureCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<TestBodyStructureCommandOutput> {
return deserializeAws_restJson1TestBodyStructureCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
Loading