Skip to content

Commit 2cfa8bf

Browse files
authored
chore(deps): bump smithy to 1.14.x (#3053)
1 parent ba14b3c commit 2cfa8bf

File tree

12 files changed

+1337
-9
lines changed

12 files changed

+1337
-9
lines changed

codegen/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ allprojects {
3131
version = "0.7.0"
3232
}
3333

34-
extra["smithyVersion"] = "[1.12.0,1.13.0["
34+
extra["smithyVersion"] = "[1.14.0,1.15.0["
3535

3636
// The root project doesn't produce a JAR.
3737
tasks["jar"].enabled = false

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,14 @@ private static boolean filterProtocolTests(
301301
if (testCase.getId().equals("RestJsonNoInputAndOutput")) {
302302
return true;
303303
}
304+
// TODO: Remove when server protocol tests are fixed in
305+
// https://github.com/aws/aws-sdk-js-v3/issues/3058
306+
// TODO: Move to filter specific to server protocol tests if added in
307+
// https://github.com/awslabs/smithy-typescript/issues/470
308+
if (testCase.getId().equals("RestJsonTestPayloadStructure")
309+
|| testCase.getId().equals("RestJsonHttpWithHeadersButNoPayload")) {
310+
return true;
311+
}
304312
return false;
305313
}
306314

@@ -331,11 +339,6 @@ private static boolean filterMalformedRequestTests(
331339
if (testCase.getId().equals("RestJsonMalformedPatternReDOSString")) {
332340
return true;
333341
}
334-
//TODO: broken in Smithy 1.12.0, remove after next Smithy release
335-
if (testCase.getId().equals("RestJsonMalformedLengthBlobOverride_case1")
336-
|| testCase.getId().equals("RestJsonMalformedRequiredQueryNoValue")) {
337-
return true;
338-
}
339342

340343
return false;
341344
}

private/aws-protocoltests-restjson/src/RestJsonProtocol.ts

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,26 @@ import {
370370
StreamingTraitsWithMediaTypeCommandInput,
371371
StreamingTraitsWithMediaTypeCommandOutput,
372372
} from "./commands/StreamingTraitsWithMediaTypeCommand";
373+
import {
374+
TestBodyStructureCommand,
375+
TestBodyStructureCommandInput,
376+
TestBodyStructureCommandOutput,
377+
} from "./commands/TestBodyStructureCommand";
378+
import {
379+
TestNoPayloadCommand,
380+
TestNoPayloadCommandInput,
381+
TestNoPayloadCommandOutput,
382+
} from "./commands/TestNoPayloadCommand";
383+
import {
384+
TestPayloadBlobCommand,
385+
TestPayloadBlobCommandInput,
386+
TestPayloadBlobCommandOutput,
387+
} from "./commands/TestPayloadBlobCommand";
388+
import {
389+
TestPayloadStructureCommand,
390+
TestPayloadStructureCommandInput,
391+
TestPayloadStructureCommandOutput,
392+
} from "./commands/TestPayloadStructureCommand";
373393
import {
374394
TimestampFormatHeadersCommand,
375395
TimestampFormatHeadersCommandInput,
@@ -2762,6 +2782,155 @@ export class RestJsonProtocol extends RestJsonProtocolClient {
27622782
}
27632783
}
27642784

2785+
/**
2786+
* This example operation serializes a structure in the HTTP body.
2787+
*
2788+
* It should ensure Content-Type: application/json is
2789+
* used in all requests and that an "empty" body is
2790+
* an empty JSON document ({}).
2791+
*
2792+
*/
2793+
public testBodyStructure(
2794+
args: TestBodyStructureCommandInput,
2795+
options?: __HttpHandlerOptions
2796+
): Promise<TestBodyStructureCommandOutput>;
2797+
public testBodyStructure(
2798+
args: TestBodyStructureCommandInput,
2799+
cb: (err: any, data?: TestBodyStructureCommandOutput) => void
2800+
): void;
2801+
public testBodyStructure(
2802+
args: TestBodyStructureCommandInput,
2803+
options: __HttpHandlerOptions,
2804+
cb: (err: any, data?: TestBodyStructureCommandOutput) => void
2805+
): void;
2806+
public testBodyStructure(
2807+
args: TestBodyStructureCommandInput,
2808+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TestBodyStructureCommandOutput) => void),
2809+
cb?: (err: any, data?: TestBodyStructureCommandOutput) => void
2810+
): Promise<TestBodyStructureCommandOutput> | void {
2811+
const command = new TestBodyStructureCommand(args);
2812+
if (typeof optionsOrCb === "function") {
2813+
this.send(command, optionsOrCb);
2814+
} else if (typeof cb === "function") {
2815+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
2816+
this.send(command, optionsOrCb || {}, cb);
2817+
} else {
2818+
return this.send(command, optionsOrCb);
2819+
}
2820+
}
2821+
2822+
/**
2823+
* This example operation serializes a request without an HTTP body.
2824+
*
2825+
* These tests are to ensure we do not attach a body or related headers
2826+
* (Content-Length, Content-Type) to operations that semantically
2827+
* cannot produce an HTTP body.
2828+
*
2829+
*/
2830+
public testNoPayload(
2831+
args: TestNoPayloadCommandInput,
2832+
options?: __HttpHandlerOptions
2833+
): Promise<TestNoPayloadCommandOutput>;
2834+
public testNoPayload(
2835+
args: TestNoPayloadCommandInput,
2836+
cb: (err: any, data?: TestNoPayloadCommandOutput) => void
2837+
): void;
2838+
public testNoPayload(
2839+
args: TestNoPayloadCommandInput,
2840+
options: __HttpHandlerOptions,
2841+
cb: (err: any, data?: TestNoPayloadCommandOutput) => void
2842+
): void;
2843+
public testNoPayload(
2844+
args: TestNoPayloadCommandInput,
2845+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TestNoPayloadCommandOutput) => void),
2846+
cb?: (err: any, data?: TestNoPayloadCommandOutput) => void
2847+
): Promise<TestNoPayloadCommandOutput> | void {
2848+
const command = new TestNoPayloadCommand(args);
2849+
if (typeof optionsOrCb === "function") {
2850+
this.send(command, optionsOrCb);
2851+
} else if (typeof cb === "function") {
2852+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
2853+
this.send(command, optionsOrCb || {}, cb);
2854+
} else {
2855+
return this.send(command, optionsOrCb);
2856+
}
2857+
}
2858+
2859+
/**
2860+
* This example operation serializes a payload targeting a blob.
2861+
*
2862+
* The Blob shape is not structured content and we cannot
2863+
* make assumptions about what data will be sent. This test ensures
2864+
* only a generic "Content-Type: application/octet-stream" header
2865+
* is used, and that we are not treating an empty body as an
2866+
* empty JSON document.
2867+
*
2868+
*/
2869+
public testPayloadBlob(
2870+
args: TestPayloadBlobCommandInput,
2871+
options?: __HttpHandlerOptions
2872+
): Promise<TestPayloadBlobCommandOutput>;
2873+
public testPayloadBlob(
2874+
args: TestPayloadBlobCommandInput,
2875+
cb: (err: any, data?: TestPayloadBlobCommandOutput) => void
2876+
): void;
2877+
public testPayloadBlob(
2878+
args: TestPayloadBlobCommandInput,
2879+
options: __HttpHandlerOptions,
2880+
cb: (err: any, data?: TestPayloadBlobCommandOutput) => void
2881+
): void;
2882+
public testPayloadBlob(
2883+
args: TestPayloadBlobCommandInput,
2884+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TestPayloadBlobCommandOutput) => void),
2885+
cb?: (err: any, data?: TestPayloadBlobCommandOutput) => void
2886+
): Promise<TestPayloadBlobCommandOutput> | void {
2887+
const command = new TestPayloadBlobCommand(args);
2888+
if (typeof optionsOrCb === "function") {
2889+
this.send(command, optionsOrCb);
2890+
} else if (typeof cb === "function") {
2891+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
2892+
this.send(command, optionsOrCb || {}, cb);
2893+
} else {
2894+
return this.send(command, optionsOrCb);
2895+
}
2896+
}
2897+
2898+
/**
2899+
* This example operation serializes a payload targeting a structure.
2900+
*
2901+
* This enforces the same requirements as TestBodyStructure
2902+
* but with the body specified by the @httpPayload trait.
2903+
*
2904+
*/
2905+
public testPayloadStructure(
2906+
args: TestPayloadStructureCommandInput,
2907+
options?: __HttpHandlerOptions
2908+
): Promise<TestPayloadStructureCommandOutput>;
2909+
public testPayloadStructure(
2910+
args: TestPayloadStructureCommandInput,
2911+
cb: (err: any, data?: TestPayloadStructureCommandOutput) => void
2912+
): void;
2913+
public testPayloadStructure(
2914+
args: TestPayloadStructureCommandInput,
2915+
options: __HttpHandlerOptions,
2916+
cb: (err: any, data?: TestPayloadStructureCommandOutput) => void
2917+
): void;
2918+
public testPayloadStructure(
2919+
args: TestPayloadStructureCommandInput,
2920+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: TestPayloadStructureCommandOutput) => void),
2921+
cb?: (err: any, data?: TestPayloadStructureCommandOutput) => void
2922+
): Promise<TestPayloadStructureCommandOutput> | void {
2923+
const command = new TestPayloadStructureCommand(args);
2924+
if (typeof optionsOrCb === "function") {
2925+
this.send(command, optionsOrCb);
2926+
} else if (typeof cb === "function") {
2927+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
2928+
this.send(command, optionsOrCb || {}, cb);
2929+
} else {
2930+
return this.send(command, optionsOrCb);
2931+
}
2932+
}
2933+
27652934
/**
27662935
* This example tests how timestamp request and response headers are serialized.
27672936
*/

private/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ import {
257257
StreamingTraitsWithMediaTypeCommandInput,
258258
StreamingTraitsWithMediaTypeCommandOutput,
259259
} from "./commands/StreamingTraitsWithMediaTypeCommand";
260+
import { TestBodyStructureCommandInput, TestBodyStructureCommandOutput } from "./commands/TestBodyStructureCommand";
261+
import { TestNoPayloadCommandInput, TestNoPayloadCommandOutput } from "./commands/TestNoPayloadCommand";
262+
import { TestPayloadBlobCommandInput, TestPayloadBlobCommandOutput } from "./commands/TestPayloadBlobCommand";
263+
import {
264+
TestPayloadStructureCommandInput,
265+
TestPayloadStructureCommandOutput,
266+
} from "./commands/TestPayloadStructureCommand";
260267
import {
261268
TimestampFormatHeadersCommandInput,
262269
TimestampFormatHeadersCommandOutput,
@@ -342,6 +349,10 @@ export type ServiceInputTypes =
342349
| StreamingTraitsCommandInput
343350
| StreamingTraitsRequireLengthCommandInput
344351
| StreamingTraitsWithMediaTypeCommandInput
352+
| TestBodyStructureCommandInput
353+
| TestNoPayloadCommandInput
354+
| TestPayloadBlobCommandInput
355+
| TestPayloadStructureCommandInput
345356
| TimestampFormatHeadersCommandInput;
346357

347358
export type ServiceOutputTypes =
@@ -423,6 +434,10 @@ export type ServiceOutputTypes =
423434
| StreamingTraitsCommandOutput
424435
| StreamingTraitsRequireLengthCommandOutput
425436
| StreamingTraitsWithMediaTypeCommandOutput
437+
| TestBodyStructureCommandOutput
438+
| TestNoPayloadCommandOutput
439+
| TestPayloadBlobCommandOutput
440+
| TestPayloadStructureCommandOutput
426441
| TimestampFormatHeadersCommandOutput;
427442

428443
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
2+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
3+
import { Command as $Command } from "@aws-sdk/smithy-client";
4+
import {
5+
FinalizeHandlerArguments,
6+
Handler,
7+
HandlerExecutionContext,
8+
HttpHandlerOptions as __HttpHandlerOptions,
9+
MetadataBearer as __MetadataBearer,
10+
MiddlewareStack,
11+
SerdeContext as __SerdeContext,
12+
} from "@aws-sdk/types";
13+
14+
import { TestBodyStructureInputOutput } from "../models/models_0";
15+
import {
16+
deserializeAws_restJson1TestBodyStructureCommand,
17+
serializeAws_restJson1TestBodyStructureCommand,
18+
} from "../protocols/Aws_restJson1";
19+
import { RestJsonProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../RestJsonProtocolClient";
20+
21+
export interface TestBodyStructureCommandInput extends TestBodyStructureInputOutput {}
22+
export interface TestBodyStructureCommandOutput extends TestBodyStructureInputOutput, __MetadataBearer {}
23+
24+
/**
25+
* This example operation serializes a structure in the HTTP body.
26+
*
27+
* It should ensure Content-Type: application/json is
28+
* used in all requests and that an "empty" body is
29+
* an empty JSON document ({}).
30+
*
31+
* @example
32+
* Use a bare-bones client and the command you need to make an API call.
33+
* ```javascript
34+
* import { RestJsonProtocolClient, TestBodyStructureCommand } from "@aws-sdk/aws-protocoltests-restjson"; // ES Modules import
35+
* // const { RestJsonProtocolClient, TestBodyStructureCommand } = require("@aws-sdk/aws-protocoltests-restjson"); // CommonJS import
36+
* const client = new RestJsonProtocolClient(config);
37+
* const command = new TestBodyStructureCommand(input);
38+
* const response = await client.send(command);
39+
* ```
40+
*
41+
* @see {@link TestBodyStructureCommandInput} for command's `input` shape.
42+
* @see {@link TestBodyStructureCommandOutput} for command's `response` shape.
43+
* @see {@link RestJsonProtocolClientResolvedConfig | config} for RestJsonProtocolClient's `config` shape.
44+
*
45+
*/
46+
export class TestBodyStructureCommand extends $Command<
47+
TestBodyStructureCommandInput,
48+
TestBodyStructureCommandOutput,
49+
RestJsonProtocolClientResolvedConfig
50+
> {
51+
// Start section: command_properties
52+
// End section: command_properties
53+
54+
constructor(readonly input: TestBodyStructureCommandInput) {
55+
// Start section: command_constructor
56+
super();
57+
// End section: command_constructor
58+
}
59+
60+
/**
61+
* @internal
62+
*/
63+
resolveMiddleware(
64+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
65+
configuration: RestJsonProtocolClientResolvedConfig,
66+
options?: __HttpHandlerOptions
67+
): Handler<TestBodyStructureCommandInput, TestBodyStructureCommandOutput> {
68+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
69+
70+
const stack = clientStack.concat(this.middlewareStack);
71+
72+
const { logger } = configuration;
73+
const clientName = "RestJsonProtocolClient";
74+
const commandName = "TestBodyStructureCommand";
75+
const handlerExecutionContext: HandlerExecutionContext = {
76+
logger,
77+
clientName,
78+
commandName,
79+
inputFilterSensitiveLog: TestBodyStructureInputOutput.filterSensitiveLog,
80+
outputFilterSensitiveLog: TestBodyStructureInputOutput.filterSensitiveLog,
81+
};
82+
const { requestHandler } = configuration;
83+
return stack.resolve(
84+
(request: FinalizeHandlerArguments<any>) =>
85+
requestHandler.handle(request.request as __HttpRequest, options || {}),
86+
handlerExecutionContext
87+
);
88+
}
89+
90+
private serialize(input: TestBodyStructureCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
91+
return serializeAws_restJson1TestBodyStructureCommand(input, context);
92+
}
93+
94+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<TestBodyStructureCommandOutput> {
95+
return deserializeAws_restJson1TestBodyStructureCommand(output, context);
96+
}
97+
98+
// Start section: command_body_extra
99+
// End section: command_body_extra
100+
}

0 commit comments

Comments
 (0)