Skip to content

Commit d8255ac

Browse files
authored
feat: schema code generation (#1599)
1 parent a50e223 commit d8255ac

File tree

64 files changed

+9681
-212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+9681
-212
lines changed

.changeset/sharp-poets-retire.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ sync:
1010
generate-protocol-tests:
1111
./gradlew :smithy-typescript-protocol-test-codegen:build
1212
rm -rf ./private/smithy-rpcv2-cbor
13+
rm -rf ./private/smithy-rpcv2-cbor-schema
1314
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/smithy-rpcv2-cbor/typescript-codegen ./private/smithy-rpcv2-cbor
15+
cp -r ./smithy-typescript-protocol-test-codegen/build/smithyprojections/smithy-typescript-protocol-test-codegen/smithy-rpcv2-cbor-schema/typescript-codegen ./private/smithy-rpcv2-cbor-schema
1416
node ./scripts/post-protocol-test-codegen
1517
npx prettier --write ./private/smithy-rpcv2-cbor
18+
npx prettier --write ./private/smithy-rpcv2-cbor-schema
1619
yarn
1720

1821
test-protocols:
1922
(cd ./private/smithy-rpcv2-cbor && npx vitest run --globals)
23+
(cd ./private/smithy-rpcv2-cbor-schema && npx vitest run --globals)
2024

2125
test-unit:
2226
yarn g:vitest run -c vitest.config.ts

packages/core/src/submodules/cbor/SmithyRpcV2CborProtocol.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ describe(SmithyRpcV2CborProtocol.name, () => {
155155
{
156156
name: "dummy",
157157
input: testCase.schema,
158-
output: void 0,
158+
output: "unit",
159159
traits: {},
160160
},
161161
testCase.input,
@@ -257,7 +257,7 @@ describe(SmithyRpcV2CborProtocol.name, () => {
257257
const output = await protocol.deserializeResponse(
258258
{
259259
name: "dummy",
260-
input: void 0,
260+
input: "unit",
261261
output: testCase.schema,
262262
traits: {},
263263
},

packages/core/src/submodules/protocols/HttpBindingProtocol.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
CodecSettings,
66
HandlerExecutionContext,
77
HttpResponse as IHttpResponse,
8+
MetadataBearer,
89
OperationSchema,
910
ResponseMetadata,
1011
ShapeDeserializer,
@@ -64,7 +65,7 @@ describe(HttpBindingProtocol.name, () => {
6465
});
6566

6667
const protocol = new StringRestProtocol();
67-
const output = await protocol.deserializeResponse(
68+
const output = (await protocol.deserializeResponse(
6869
op(
6970
"",
7071
"",
@@ -87,7 +88,7 @@ describe(HttpBindingProtocol.name, () => {
8788
),
8889
{} as any,
8990
response
90-
);
91+
)) as Partial<MetadataBearer>;
9192
delete output.$metadata;
9293
expect(output).toEqual({
9394
timestampList: [new Date("2019-12-16T23:48:18.000Z"), new Date("2019-12-16T23:48:18.000Z")],
@@ -104,7 +105,7 @@ describe(HttpBindingProtocol.name, () => {
104105
});
105106

106107
const protocol = new StringRestProtocol();
107-
const output = await protocol.deserializeResponse(
108+
const output = (await protocol.deserializeResponse(
108109
op(
109110
"",
110111
"",
@@ -127,7 +128,7 @@ describe(HttpBindingProtocol.name, () => {
127128
),
128129
{} as any,
129130
response
130-
);
131+
)) as Partial<MetadataBearer>;
131132
delete output.$metadata;
132133
expect(output).toEqual({
133134
httpPrefixHeaders: {
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"name": "@smithy/smithy-rpcv2-cbor-schema",
3+
"description": "@smithy/smithy-rpcv2-cbor-schema client",
4+
"version": "1.0.0-alpha.1",
5+
"scripts": {
6+
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7+
"build:cjs": "tsc -p tsconfig.cjs.json",
8+
"build:es": "tsc -p tsconfig.es.json",
9+
"build:types": "tsc -p tsconfig.types.json",
10+
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
11+
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
12+
"prepack": "yarn run clean && yarn run build",
13+
"test": "yarn g:vitest run --passWithNoTests"
14+
},
15+
"main": "./dist-cjs/index.js",
16+
"types": "./dist-types/index.d.ts",
17+
"module": "./dist-es/index.js",
18+
"sideEffects": false,
19+
"dependencies": {
20+
"@aws-crypto/sha256-browser": "5.2.0",
21+
"@aws-crypto/sha256-js": "5.2.0",
22+
"@aws-sdk/types": "latest",
23+
"@smithy/config-resolver": "workspace:^",
24+
"@smithy/core": "workspace:^",
25+
"@smithy/fetch-http-handler": "workspace:^",
26+
"@smithy/hash-node": "workspace:^",
27+
"@smithy/invalid-dependency": "workspace:^",
28+
"@smithy/middleware-content-length": "workspace:^",
29+
"@smithy/middleware-endpoint": "workspace:^",
30+
"@smithy/middleware-retry": "workspace:^",
31+
"@smithy/middleware-serde": "workspace:^",
32+
"@smithy/middleware-stack": "workspace:^",
33+
"@smithy/node-config-provider": "workspace:^",
34+
"@smithy/node-http-handler": "workspace:^",
35+
"@smithy/protocol-http": "workspace:^",
36+
"@smithy/smithy-client": "workspace:^",
37+
"@smithy/types": "workspace:^",
38+
"@smithy/url-parser": "workspace:^",
39+
"@smithy/util-base64": "workspace:^",
40+
"@smithy/util-body-length-browser": "workspace:^",
41+
"@smithy/util-body-length-node": "workspace:^",
42+
"@smithy/util-defaults-mode-browser": "workspace:^",
43+
"@smithy/util-defaults-mode-node": "workspace:^",
44+
"@smithy/util-endpoints": "workspace:^",
45+
"@smithy/util-middleware": "workspace:^",
46+
"@smithy/util-retry": "workspace:^",
47+
"@smithy/util-utf8": "workspace:^",
48+
"tslib": "^2.6.2"
49+
},
50+
"devDependencies": {
51+
"@tsconfig/node18": "18.2.4",
52+
"@types/node": "^18.19.69",
53+
"concurrently": "7.0.0",
54+
"downlevel-dts": "0.10.1",
55+
"rimraf": "^3.0.0",
56+
"typescript": "~5.8.3",
57+
"vitest": "2.1.8"
58+
},
59+
"engines": {
60+
"node": ">=18.0.0"
61+
},
62+
"typesVersions": {
63+
"<4.0": {
64+
"dist-types/*": [
65+
"dist-types/ts3.4/*"
66+
]
67+
}
68+
},
69+
"files": [
70+
"dist-*/**"
71+
],
72+
"author": {
73+
"name": "Smithy team",
74+
"url": "https://smithy.io/"
75+
},
76+
"license": "Apache-2.0",
77+
"browser": {
78+
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
79+
},
80+
"react-native": {
81+
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native"
82+
},
83+
"private": true
84+
}

0 commit comments

Comments
 (0)