@distilled.cloud/core 1.0.0-rc.17 → 1.0.0-rc.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_bundle/base.js +2 -2
- package/lib/_bundle/base.js.map +1 -1
- package/lib/_bundle/graphql.js +2 -2
- package/lib/_bundle/graphql.js.map +1 -1
- package/lib/_bundle/rest.js +1 -1
- package/lib/_bundle/rest.js.map +1 -1
- package/lib/annotations.d.ts +15 -0
- package/lib/annotations.d.ts.map +1 -0
- package/lib/annotations.js +2 -0
- package/lib/annotations.js.map +1 -0
- package/lib/api.d.ts +15 -0
- package/lib/api.d.ts.map +1 -1
- package/lib/api.js +1 -1
- package/lib/category.d.ts.map +1 -1
- package/lib/config.d.ts +54 -13
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +1 -1
- package/lib/debug.d.ts.map +1 -1
- package/lib/error-category.d.ts.map +1 -1
- package/lib/errors.d.ts +2 -13
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +1 -1
- package/lib/graphql.d.ts +14 -0
- package/lib/graphql.d.ts.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/pagination.d.ts +34 -2
- package/lib/pagination.d.ts.map +1 -1
- package/lib/pagination.js +1 -1
- package/lib/protocol-http.d.ts +30 -6
- package/lib/protocol-http.d.ts.map +1 -1
- package/lib/protocol-http.js +1 -1
- package/lib/protocol-rest.d.ts +53 -39
- package/lib/protocol-rest.d.ts.map +1 -1
- package/lib/protocol-rest.js +1 -1
- package/lib/response-validation.d.ts +4 -3
- package/lib/response-validation.d.ts.map +1 -1
- package/lib/schema-lite-typed.js +1 -2
- package/lib/telemetry-debug.d.ts +14 -0
- package/lib/telemetry-debug.d.ts.map +1 -0
- package/lib/telemetry-debug.js +2 -0
- package/lib/telemetry-debug.js.map +1 -0
- package/lib/telemetry-hooks.d.ts +32 -0
- package/lib/telemetry-hooks.d.ts.map +1 -0
- package/lib/telemetry-hooks.js +2 -0
- package/lib/telemetry-hooks.js.map +1 -0
- package/lib/telemetry-host-rules.d.ts +23 -0
- package/lib/telemetry-host-rules.d.ts.map +1 -0
- package/lib/telemetry-host-rules.js +2 -0
- package/lib/telemetry-host-rules.js.map +1 -0
- package/lib/telemetry-lambda-context.d.ts +17 -0
- package/lib/telemetry-lambda-context.d.ts.map +1 -0
- package/lib/telemetry-lambda-context.js +2 -0
- package/lib/telemetry-lambda-context.js.map +1 -0
- package/lib/telemetry-message-context.d.ts +52 -0
- package/lib/telemetry-message-context.d.ts.map +1 -0
- package/lib/telemetry-message-context.js +2 -0
- package/lib/telemetry-message-context.js.map +1 -0
- package/lib/telemetry-metrics.d.ts +6 -0
- package/lib/telemetry-metrics.d.ts.map +1 -0
- package/lib/telemetry-metrics.js +2 -0
- package/lib/telemetry-metrics.js.map +1 -0
- package/lib/telemetry-name-template.d.ts +13 -0
- package/lib/telemetry-name-template.d.ts.map +1 -0
- package/lib/telemetry-name-template.js +2 -0
- package/lib/telemetry-name-template.js.map +1 -0
- package/lib/telemetry-stream.d.ts +9 -0
- package/lib/telemetry-stream.d.ts.map +1 -0
- package/lib/telemetry-stream.js +2 -0
- package/lib/telemetry-stream.js.map +1 -0
- package/lib/telemetry-xray.d.ts +28 -0
- package/lib/telemetry-xray.d.ts.map +1 -0
- package/lib/telemetry-xray.js +2 -0
- package/lib/telemetry-xray.js.map +1 -0
- package/lib/telemetry.d.ts +269 -0
- package/lib/telemetry.d.ts.map +1 -0
- package/lib/telemetry.js +3 -0
- package/lib/telemetry.js.map +1 -0
- package/package.json +1 -3
- package/src/annotations.ts +37 -0
- package/src/api.ts +123 -24
- package/src/category.ts +21 -22
- package/src/config.ts +58 -29
- package/src/debug.ts +9 -6
- package/src/error-category.ts +12 -14
- package/src/errors.ts +7 -7
- package/src/graphql.ts +123 -18
- package/src/index.ts +3 -2
- package/src/pagination.ts +119 -6
- package/src/protocol-http.ts +63 -43
- package/src/protocol-rest.ts +201 -140
- package/src/response-validation.ts +4 -3
- package/src/telemetry-debug.ts +135 -0
- package/src/telemetry-hooks.ts +33 -0
- package/src/telemetry-host-rules.ts +39 -0
- package/src/telemetry-lambda-context.ts +46 -0
- package/src/telemetry-message-context.ts +170 -0
- package/src/telemetry-metrics.ts +69 -0
- package/src/telemetry-name-template.ts +26 -0
- package/src/telemetry-stream.ts +91 -0
- package/src/telemetry-xray.ts +66 -0
- package/src/telemetry.ts +768 -0
- package/lib/codegen/boolean-string-enums.d.ts +0 -36
- package/lib/codegen/boolean-string-enums.d.ts.map +0 -1
- package/lib/codegen/boolean-string-enums.js +0 -147
- package/lib/codegen/boolean-string-enums.js.map +0 -1
- package/lib/codegen/chunk.d.ts +0 -7
- package/lib/codegen/chunk.d.ts.map +0 -1
- package/lib/codegen/chunk.js +0 -139
- package/lib/codegen/chunk.js.map +0 -1
- package/lib/codegen/cli.d.ts +0 -80
- package/lib/codegen/cli.d.ts.map +0 -1
- package/lib/codegen/cli.js +0 -166
- package/lib/codegen/cli.js.map +0 -1
- package/lib/codegen/datafy.d.ts +0 -14
- package/lib/codegen/datafy.d.ts.map +0 -1
- package/lib/codegen/datafy.js +0 -853
- package/lib/codegen/datafy.js.map +0 -1
- package/lib/codegen/dedupe.d.ts +0 -5
- package/lib/codegen/dedupe.d.ts.map +0 -1
- package/lib/codegen/dedupe.js +0 -153
- package/lib/codegen/dedupe.js.map +0 -1
- package/lib/codegen/emit.d.ts +0 -125
- package/lib/codegen/emit.d.ts.map +0 -1
- package/lib/codegen/emit.js +0 -99
- package/lib/codegen/emit.js.map +0 -1
- package/lib/codegen/format.d.ts +0 -11
- package/lib/codegen/format.d.ts.map +0 -1
- package/lib/codegen/format.js +0 -32
- package/lib/codegen/format.js.map +0 -1
- package/lib/codegen/generated-at.d.ts +0 -29
- package/lib/codegen/generated-at.d.ts.map +0 -1
- package/lib/codegen/generated-at.js +0 -78
- package/lib/codegen/generated-at.js.map +0 -1
- package/lib/codegen/generator.d.ts +0 -353
- package/lib/codegen/generator.d.ts.map +0 -1
- package/lib/codegen/generator.js +0 -810
- package/lib/codegen/generator.js.map +0 -1
- package/lib/codegen/graph.d.ts +0 -36
- package/lib/codegen/graph.d.ts.map +0 -1
- package/lib/codegen/graph.js +0 -136
- package/lib/codegen/graph.js.map +0 -1
- package/lib/codegen/graphql-client.d.ts +0 -70
- package/lib/codegen/graphql-client.d.ts.map +0 -1
- package/lib/codegen/graphql-client.js +0 -439
- package/lib/codegen/graphql-client.js.map +0 -1
- package/lib/codegen/graphql.d.ts +0 -207
- package/lib/codegen/graphql.d.ts.map +0 -1
- package/lib/codegen/graphql.js +0 -786
- package/lib/codegen/graphql.js.map +0 -1
- package/lib/codegen/latin1.d.ts +0 -3
- package/lib/codegen/latin1.d.ts.map +0 -1
- package/lib/codegen/latin1.js +0 -126
- package/lib/codegen/latin1.js.map +0 -1
- package/lib/codegen/members.d.ts +0 -32
- package/lib/codegen/members.d.ts.map +0 -1
- package/lib/codegen/members.js +0 -62
- package/lib/codegen/members.js.map +0 -1
- package/lib/codegen/model-diff.d.ts +0 -10
- package/lib/codegen/model-diff.d.ts.map +0 -1
- package/lib/codegen/model-diff.js +0 -67
- package/lib/codegen/model-diff.js.map +0 -1
- package/lib/codegen/naming.d.ts +0 -29
- package/lib/codegen/naming.d.ts.map +0 -1
- package/lib/codegen/naming.js +0 -74
- package/lib/codegen/naming.js.map +0 -1
- package/lib/codegen/openapi-cli.d.ts +0 -52
- package/lib/codegen/openapi-cli.d.ts.map +0 -1
- package/lib/codegen/openapi-cli.js +0 -84
- package/lib/codegen/openapi-cli.js.map +0 -1
- package/lib/codegen/openapi.d.ts +0 -209
- package/lib/codegen/openapi.d.ts.map +0 -1
- package/lib/codegen/openapi.js +0 -1548
- package/lib/codegen/openapi.js.map +0 -1
- package/lib/codegen/operations.d.ts +0 -24
- package/lib/codegen/operations.d.ts.map +0 -1
- package/lib/codegen/operations.js +0 -56
- package/lib/codegen/operations.js.map +0 -1
- package/lib/codegen/pagination.d.ts +0 -39
- package/lib/codegen/pagination.d.ts.map +0 -1
- package/lib/codegen/pagination.js +0 -31
- package/lib/codegen/pagination.js.map +0 -1
- package/lib/codegen/patch-audit.d.ts +0 -84
- package/lib/codegen/patch-audit.d.ts.map +0 -1
- package/lib/codegen/patch-audit.js +0 -366
- package/lib/codegen/patch-audit.js.map +0 -1
- package/lib/codegen/patches.d.ts +0 -129
- package/lib/codegen/patches.d.ts.map +0 -1
- package/lib/codegen/patches.js +0 -472
- package/lib/codegen/patches.js.map +0 -1
- package/lib/codegen/prelude.d.ts +0 -15
- package/lib/codegen/prelude.d.ts.map +0 -1
- package/lib/codegen/prelude.js +0 -60
- package/lib/codegen/prelude.js.map +0 -1
- package/lib/codegen/privatize.d.ts +0 -21
- package/lib/codegen/privatize.d.ts.map +0 -1
- package/lib/codegen/privatize.js +0 -176
- package/lib/codegen/privatize.js.map +0 -1
- package/lib/codegen/proto.d.ts +0 -121
- package/lib/codegen/proto.d.ts.map +0 -1
- package/lib/codegen/proto.js +0 -960
- package/lib/codegen/proto.js.map +0 -1
- package/lib/codegen/pure.d.ts +0 -6
- package/lib/codegen/pure.d.ts.map +0 -1
- package/lib/codegen/pure.js +0 -91
- package/lib/codegen/pure.js.map +0 -1
- package/lib/codegen/rewrite-operation-ids.d.ts +0 -154
- package/lib/codegen/rewrite-operation-ids.d.ts.map +0 -1
- package/lib/codegen/rewrite-operation-ids.js +0 -1117
- package/lib/codegen/rewrite-operation-ids.js.map +0 -1
- package/lib/codegen/spec-path.d.ts +0 -16
- package/lib/codegen/spec-path.d.ts.map +0 -1
- package/lib/codegen/spec-path.js +0 -101
- package/lib/codegen/spec-path.js.map +0 -1
- package/lib/codegen/table.d.ts +0 -5
- package/lib/codegen/table.d.ts.map +0 -1
- package/lib/codegen/table.js +0 -249
- package/lib/codegen/table.js.map +0 -1
- package/lib/json-patch.d.ts +0 -58
- package/lib/json-patch.d.ts.map +0 -1
- package/lib/json-patch.js +0 -2
- package/lib/json-patch.js.map +0 -1
- package/lib/schema-lite-typed.js.map +0 -1
- package/lib/testing.d.ts +0 -40
- package/lib/testing.d.ts.map +0 -1
- package/lib/testing.js +0 -2
- package/lib/testing.js.map +0 -1
- package/src/codegen/boolean-string-enums.ts +0 -155
- package/src/codegen/chunk.ts +0 -147
- package/src/codegen/cli.ts +0 -293
- package/src/codegen/datafy.ts +0 -874
- package/src/codegen/dedupe.ts +0 -173
- package/src/codegen/emit.ts +0 -200
- package/src/codegen/format.ts +0 -49
- package/src/codegen/generated-at.ts +0 -88
- package/src/codegen/generator.ts +0 -1229
- package/src/codegen/graph.ts +0 -151
- package/src/codegen/graphql-client.ts +0 -545
- package/src/codegen/graphql.ts +0 -1145
- package/src/codegen/latin1.ts +0 -131
- package/src/codegen/members.ts +0 -79
- package/src/codegen/model-diff.ts +0 -67
- package/src/codegen/naming.ts +0 -85
- package/src/codegen/openapi-cli.ts +0 -141
- package/src/codegen/openapi.ts +0 -1845
- package/src/codegen/operations.ts +0 -73
- package/src/codegen/pagination.ts +0 -64
- package/src/codegen/patch-audit.ts +0 -480
- package/src/codegen/patches.ts +0 -581
- package/src/codegen/prelude.ts +0 -70
- package/src/codegen/privatize.ts +0 -200
- package/src/codegen/proto.ts +0 -1092
- package/src/codegen/pure.ts +0 -94
- package/src/codegen/rewrite-operation-ids.ts +0 -1219
- package/src/codegen/spec-path.ts +0 -112
- package/src/codegen/table.ts +0 -254
- package/src/json-patch.ts +0 -273
- package/src/testing.ts +0 -74
package/lib/codegen/openapi.js
DELETED
|
@@ -1,1548 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
import { ADDITIONAL_PROPERTIES_TRAIT } from "./members.js";
|
|
47
|
-
import { isMechanicalOperationId, isVerbatimRouteId, pathToVerbNoun, RENAME_METADATA_KEY, renameShapes, resolveOperationName, toVerbNoun, } from "./rewrite-operation-ids.js";
|
|
48
|
-
// ============================================================================
|
|
49
|
-
// Trait ids (the `com.distilled.openapi` vocabulary)
|
|
50
|
-
// ============================================================================
|
|
51
|
-
|
|
52
|
-
export const NULLABLE_TRAIT = "com.distilled.openapi#nullable";
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
export const RAW_RESPONSE_TRAIT = "com.distilled.openapi#rawResponse";
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export const ERROR_MATCHERS_TRAIT = "com.distilled.openapi#errorMatchers";
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
export const CONTENT_TYPE_TRAIT = "com.distilled.openapi#contentType";
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
export const API_VERSION_TRAIT = "com.distilled.openapi#apiVersion";
|
|
81
|
-
// ============================================================================
|
|
82
|
-
// Sensitive-field name patterns (distilled v0's SENSITIVE_FIELD_PATTERNS)
|
|
83
|
-
// ============================================================================
|
|
84
|
-
export const SENSITIVE_FIELD_PATTERNS = [
|
|
85
|
-
/password/i,
|
|
86
|
-
/^secret$/i,
|
|
87
|
-
/secret[-_]?key/i,
|
|
88
|
-
/[-_]secret$/i,
|
|
89
|
-
/^client[-_]?secret$/i,
|
|
90
|
-
/^access[-_]?token$/i,
|
|
91
|
-
/^refresh[-_]?token$/i,
|
|
92
|
-
/^api[-_]?key$/i,
|
|
93
|
-
/^api[-_]?key[-_]?secret$/i,
|
|
94
|
-
/^api[-_]?token$/i,
|
|
95
|
-
/^private[-_]?key$/i,
|
|
96
|
-
/^secret[-_]?access[-_]?key$/i,
|
|
97
|
-
/^session[-_]?token$/i,
|
|
98
|
-
/^access[-_]?key[-_]?id$/i,
|
|
99
|
-
/^one[-_]?time[-_]?password$/i,
|
|
100
|
-
/^connection[-_]?string$/i,
|
|
101
|
-
/^connection[-_]?uri$/i,
|
|
102
|
-
/^plain[-_]?text$/i,
|
|
103
|
-
/^plain[-_]?text[-_]?refresh[-_]?token$/i,
|
|
104
|
-
];
|
|
105
|
-
// ============================================================================
|
|
106
|
-
// String helpers (same conventions as cloudflare's spec-to-smithy)
|
|
107
|
-
// ============================================================================
|
|
108
|
-
const PRELUDE = {
|
|
109
|
-
Unit: "smithy.api#Unit",
|
|
110
|
-
String: "smithy.api#String",
|
|
111
|
-
Blob: "smithy.api#Blob",
|
|
112
|
-
Boolean: "smithy.api#Boolean",
|
|
113
|
-
Double: "smithy.api#Double",
|
|
114
|
-
Integer: "smithy.api#Integer",
|
|
115
|
-
Document: "smithy.api#Document",
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const pascal = (s) => {
|
|
119
|
-
const parts = s.split(/[^A-Za-z0-9]+/).filter(Boolean);
|
|
120
|
-
let out = parts.map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join("");
|
|
121
|
-
if (out === "")
|
|
122
|
-
out = "Shape";
|
|
123
|
-
if (/^[0-9]/.test(out))
|
|
124
|
-
out = `_${out}`;
|
|
125
|
-
return out;
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const memberIdent = (name) => {
|
|
129
|
-
let out = name.replace(/[^A-Za-z0-9_]/g, "_");
|
|
130
|
-
if (/^[0-9]/.test(out))
|
|
131
|
-
out = `_${out}`;
|
|
132
|
-
return out || "_";
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const headerMemberName = (name) => {
|
|
140
|
-
const parts = name.split(/[^A-Za-z0-9]+/).filter(Boolean);
|
|
141
|
-
if (parts.length === 0)
|
|
142
|
-
return "_";
|
|
143
|
-
const out = parts
|
|
144
|
-
.map((p, i) => i === 0 ? p.charAt(0).toLowerCase() + p.slice(1) : p.charAt(0).toUpperCase() + p.slice(1))
|
|
145
|
-
.join("");
|
|
146
|
-
return /^[0-9]/.test(out) ? `_${out}` : out;
|
|
147
|
-
};
|
|
148
|
-
const enumMemberName = (value) => {
|
|
149
|
-
let out = value
|
|
150
|
-
.toUpperCase()
|
|
151
|
-
.replace(/[^A-Z0-9]+/g, "_")
|
|
152
|
-
.replace(/^_+|_+$/g, "");
|
|
153
|
-
if (out === "")
|
|
154
|
-
out = "VALUE";
|
|
155
|
-
if (/^[0-9]/.test(out))
|
|
156
|
-
out = `_${out}`;
|
|
157
|
-
return out;
|
|
158
|
-
};
|
|
159
|
-
// ============================================================================
|
|
160
|
-
// Conversion context
|
|
161
|
-
// ============================================================================
|
|
162
|
-
const MAX_SCHEMA_DEPTH = 40;
|
|
163
|
-
const uniqueName = (ctx, base) => {
|
|
164
|
-
const want = pascal(base);
|
|
165
|
-
let name = want;
|
|
166
|
-
let n = 2;
|
|
167
|
-
while (ctx.names.has(name))
|
|
168
|
-
name = `${want}${n++}`;
|
|
169
|
-
ctx.names.add(name);
|
|
170
|
-
return name;
|
|
171
|
-
};
|
|
172
|
-
const addShape = (ctx, base, def) => {
|
|
173
|
-
const id = `${ctx.ns}#${uniqueName(ctx, base)}`;
|
|
174
|
-
ctx.shapes[id] = def;
|
|
175
|
-
return id;
|
|
176
|
-
};
|
|
177
|
-
const detectVersion = (spec) => {
|
|
178
|
-
if (spec?.swagger === "2.0")
|
|
179
|
-
return "2.0";
|
|
180
|
-
const v = spec?.openapi;
|
|
181
|
-
if (typeof v === "string" && v.startsWith("3.1"))
|
|
182
|
-
return "3.1";
|
|
183
|
-
if (typeof v === "string" && v.startsWith("3.0"))
|
|
184
|
-
return "3.0";
|
|
185
|
-
throw new Error(`Unsupported OpenAPI version (swagger=${spec?.swagger}, openapi=${spec?.openapi})`);
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const resolvePointer = (spec, ref) => {
|
|
189
|
-
if (typeof ref !== "string" || !ref.startsWith("#/"))
|
|
190
|
-
return undefined;
|
|
191
|
-
let cur = spec;
|
|
192
|
-
for (const raw of ref.slice(2).split("/")) {
|
|
193
|
-
const seg = raw.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
194
|
-
if (cur === null || typeof cur !== "object")
|
|
195
|
-
return undefined;
|
|
196
|
-
cur = cur[seg];
|
|
197
|
-
}
|
|
198
|
-
return cur;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
const deref = (ctx, def) => {
|
|
202
|
-
let cur = def;
|
|
203
|
-
for (let i = 0; i < 16 && cur && typeof cur === "object" && cur.$ref; i++) {
|
|
204
|
-
cur = resolvePointer(ctx.spec, cur.$ref);
|
|
205
|
-
}
|
|
206
|
-
return cur;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
const flattenObject = (ctx, def, depth = 0) => {
|
|
217
|
-
const out = {
|
|
218
|
-
properties: {},
|
|
219
|
-
required: new Set(),
|
|
220
|
-
isObject: false,
|
|
221
|
-
};
|
|
222
|
-
// Revisiting a `$ref` under the same flags merges nothing new (property
|
|
223
|
-
// merge is first-wins) — dedupe so shared/cyclic allOf bases are walked
|
|
224
|
-
// once per flag combination instead of exponentially (MongoDB Atlas's
|
|
225
|
-
// polymorphic allOf/oneOf graph never finished under the bare depth cap).
|
|
226
|
-
const seen = new Set();
|
|
227
|
-
const visit = (d, dep, inAllOf, inUnion) => {
|
|
228
|
-
if (dep > MAX_SCHEMA_DEPTH)
|
|
229
|
-
return;
|
|
230
|
-
if (d && typeof d === "object" && typeof d.$ref === "string") {
|
|
231
|
-
const key = `${d.$ref}|${inAllOf}|${inUnion}`;
|
|
232
|
-
if (seen.has(key))
|
|
233
|
-
return;
|
|
234
|
-
seen.add(key);
|
|
235
|
-
}
|
|
236
|
-
const r = deref(ctx, d);
|
|
237
|
-
if (!r || typeof r !== "object")
|
|
238
|
-
return;
|
|
239
|
-
if (Array.isArray(r.allOf)) {
|
|
240
|
-
for (const sub of r.allOf)
|
|
241
|
-
visit(sub, dep + 1, true, inUnion);
|
|
242
|
-
}
|
|
243
|
-
if (inAllOf) {
|
|
244
|
-
const branches = r.oneOf ?? r.anyOf;
|
|
245
|
-
if (Array.isArray(branches)) {
|
|
246
|
-
for (const b of branches) {
|
|
247
|
-
if (!isNullBranch(ctx, b))
|
|
248
|
-
visit(b, dep + 1, inAllOf, true);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
if (r.properties && typeof r.properties === "object") {
|
|
253
|
-
out.isObject = true;
|
|
254
|
-
for (const [k, v] of Object.entries(r.properties)) {
|
|
255
|
-
if (!(k in out.properties))
|
|
256
|
-
out.properties[k] = v;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (r.type === "object")
|
|
260
|
-
out.isObject = true;
|
|
261
|
-
if (out.additionalProperties === undefined &&
|
|
262
|
-
r.additionalProperties !== undefined &&
|
|
263
|
-
r.additionalProperties !== false) {
|
|
264
|
-
out.additionalProperties = r.additionalProperties;
|
|
265
|
-
}
|
|
266
|
-
if (!inUnion && Array.isArray(r.required)) {
|
|
267
|
-
for (const k of r.required)
|
|
268
|
-
out.required.add(k);
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
visit(def, depth, false, false);
|
|
272
|
-
return out;
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
const isNullBranch = (ctx, branch) => {
|
|
276
|
-
const r = deref(ctx, branch);
|
|
277
|
-
if (!r || typeof r !== "object")
|
|
278
|
-
return false;
|
|
279
|
-
if (r.type === "null")
|
|
280
|
-
return true;
|
|
281
|
-
if (Array.isArray(r.type) && r.type.every((t) => t === "null")) {
|
|
282
|
-
return true;
|
|
283
|
-
}
|
|
284
|
-
if (Array.isArray(r.enum) && r.enum.length > 0 && r.enum.every((v) => v === null)) {
|
|
285
|
-
return true;
|
|
286
|
-
}
|
|
287
|
-
return false;
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
const ownNullable = (ctx, def) => {
|
|
291
|
-
if (!def || typeof def !== "object")
|
|
292
|
-
return false;
|
|
293
|
-
// `nullable: true` is 3.0 vocabulary but appears in real 3.1 (and even
|
|
294
|
-
// 2.0) documents — honor it everywhere rather than silently dropping the
|
|
295
|
-
// null arm.
|
|
296
|
-
if (def.nullable === true)
|
|
297
|
-
return true;
|
|
298
|
-
if (def["x-nullable"] === true)
|
|
299
|
-
return true;
|
|
300
|
-
if (Array.isArray(def.type) && def.type.includes("null"))
|
|
301
|
-
return true;
|
|
302
|
-
return false;
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
const dirExcluded = (ctx, prop, dir) => {
|
|
311
|
-
const flag = dir === "in" ? "readOnly" : "writeOnly";
|
|
312
|
-
if (prop && typeof prop === "object" && prop[flag] === true)
|
|
313
|
-
return true;
|
|
314
|
-
const r = deref(ctx, prop);
|
|
315
|
-
return !!r && typeof r === "object" && r[flag] === true;
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
const schemaChildren = (d) => [
|
|
319
|
-
...(Array.isArray(d.allOf) ? d.allOf : []),
|
|
320
|
-
...(Array.isArray(d.oneOf) ? d.oneOf : []),
|
|
321
|
-
...(Array.isArray(d.anyOf) ? d.anyOf : []),
|
|
322
|
-
...(d.properties && typeof d.properties === "object" ? Object.values(d.properties) : []),
|
|
323
|
-
...(d.items ? [d.items] : []),
|
|
324
|
-
...(d.additionalProperties && typeof d.additionalProperties === "object"
|
|
325
|
-
? [d.additionalProperties]
|
|
326
|
-
: []),
|
|
327
|
-
];
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
const scanInlineForFlag = (d, flag, refs) => {
|
|
334
|
-
if (!d || typeof d !== "object")
|
|
335
|
-
return false;
|
|
336
|
-
if (typeof d.$ref === "string") {
|
|
337
|
-
refs.push(d.$ref);
|
|
338
|
-
return false;
|
|
339
|
-
}
|
|
340
|
-
if (d[flag] === true)
|
|
341
|
-
return true;
|
|
342
|
-
for (const sub of schemaChildren(d)) {
|
|
343
|
-
if (scanInlineForFlag(sub, flag, refs))
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
return false;
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
const buildDirSensitiveRefs = (ctx, dir) => {
|
|
360
|
-
const flag = dir === "in" ? "readOnly" : "writeOnly";
|
|
361
|
-
// Every distinct `$ref` pointer in the document.
|
|
362
|
-
const allRefs = new Set();
|
|
363
|
-
const collect = (d) => {
|
|
364
|
-
if (Array.isArray(d)) {
|
|
365
|
-
for (const v of d)
|
|
366
|
-
collect(v);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
if (!d || typeof d !== "object")
|
|
370
|
-
return;
|
|
371
|
-
if (typeof d.$ref === "string")
|
|
372
|
-
allRefs.add(d.$ref);
|
|
373
|
-
for (const v of Object.values(d))
|
|
374
|
-
collect(v);
|
|
375
|
-
};
|
|
376
|
-
collect(ctx.spec);
|
|
377
|
-
// ref → refs reachable in one hop; refs whose target carries the flag inline.
|
|
378
|
-
const reverse = new Map();
|
|
379
|
-
const flagged = [];
|
|
380
|
-
for (const ref of allRefs) {
|
|
381
|
-
const outgoing = [];
|
|
382
|
-
if (scanInlineForFlag(resolvePointer(ctx.spec, ref), flag, outgoing)) {
|
|
383
|
-
flagged.push(ref);
|
|
384
|
-
continue; // already sensitive; its edges can't add anything
|
|
385
|
-
}
|
|
386
|
-
for (const to of outgoing) {
|
|
387
|
-
let from = reverse.get(to);
|
|
388
|
-
if (!from)
|
|
389
|
-
reverse.set(to, (from = []));
|
|
390
|
-
from.push(ref);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
// Sensitivity propagates from flagged targets to every ref that reaches them.
|
|
394
|
-
const sensitive = new Set(flagged);
|
|
395
|
-
const queue = [...flagged];
|
|
396
|
-
while (queue.length > 0) {
|
|
397
|
-
const next = queue.pop();
|
|
398
|
-
for (const from of reverse.get(next) ?? []) {
|
|
399
|
-
if (!sensitive.has(from)) {
|
|
400
|
-
sensitive.add(from);
|
|
401
|
-
queue.push(from);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return sensitive;
|
|
406
|
-
};
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
const dirSensitive = (ctx, def, dir) => {
|
|
415
|
-
let sensitiveRefs = ctx.dirSensitiveRefs.get(dir);
|
|
416
|
-
if (sensitiveRefs === undefined) {
|
|
417
|
-
sensitiveRefs = buildDirSensitiveRefs(ctx, dir);
|
|
418
|
-
ctx.dirSensitiveRefs.set(dir, sensitiveRefs);
|
|
419
|
-
}
|
|
420
|
-
const refs = [];
|
|
421
|
-
if (scanInlineForFlag(def, dir === "in" ? "readOnly" : "writeOnly", refs)) {
|
|
422
|
-
return true;
|
|
423
|
-
}
|
|
424
|
-
return refs.some((ref) => sensitiveRefs.has(ref));
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
const typeOf = (def) => {
|
|
428
|
-
const t = def?.type;
|
|
429
|
-
if (typeof t === "string")
|
|
430
|
-
return t;
|
|
431
|
-
if (Array.isArray(t)) {
|
|
432
|
-
const real = t.filter((x) => x !== "null");
|
|
433
|
-
if (real.length === 1 && typeof real[0] === "string")
|
|
434
|
-
return real[0];
|
|
435
|
-
}
|
|
436
|
-
return undefined;
|
|
437
|
-
};
|
|
438
|
-
// ============================================================================
|
|
439
|
-
// Schema conversion
|
|
440
|
-
// ============================================================================
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
const isNameable = (ctx, def) => {
|
|
447
|
-
if (!def || typeof def !== "object")
|
|
448
|
-
return false;
|
|
449
|
-
if (def.$ref)
|
|
450
|
-
return isNameable(ctx, deref(ctx, def));
|
|
451
|
-
if (Array.isArray(def.enum)) {
|
|
452
|
-
const values = def.enum.filter((v) => v !== null);
|
|
453
|
-
return (values.length > 0 &&
|
|
454
|
-
(values.every((v) => typeof v === "string") ||
|
|
455
|
-
values.every((v) => typeof v === "number")));
|
|
456
|
-
}
|
|
457
|
-
if (Array.isArray(def.allOf))
|
|
458
|
-
return true;
|
|
459
|
-
const branches = def.oneOf ?? def.anyOf;
|
|
460
|
-
if (Array.isArray(branches)) {
|
|
461
|
-
return branches.filter((b) => !isNullBranch(ctx, b)).length >= 2;
|
|
462
|
-
}
|
|
463
|
-
const t = typeOf(def);
|
|
464
|
-
if (t === "object" || def.properties || def.additionalProperties)
|
|
465
|
-
return true;
|
|
466
|
-
if (t === "array")
|
|
467
|
-
return true;
|
|
468
|
-
return false;
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
const convertSchema = (ctx, def, hint, depth, dir, reservedId) => {
|
|
478
|
-
const emit = (shapeDef, base) => {
|
|
479
|
-
if (reservedId !== undefined) {
|
|
480
|
-
ctx.shapes[reservedId] = shapeDef;
|
|
481
|
-
return reservedId;
|
|
482
|
-
}
|
|
483
|
-
return addShape(ctx, base, shapeDef);
|
|
484
|
-
};
|
|
485
|
-
const inline = (target, nullable) => {
|
|
486
|
-
// A reserved placeholder that turned out to be inline (scalar/alias):
|
|
487
|
-
// drop the placeholder; the burned name is harmless.
|
|
488
|
-
if (reservedId !== undefined)
|
|
489
|
-
delete ctx.shapes[reservedId];
|
|
490
|
-
return { target, nullable };
|
|
491
|
-
};
|
|
492
|
-
if (depth > MAX_SCHEMA_DEPTH)
|
|
493
|
-
return inline(PRELUDE.Document, false);
|
|
494
|
-
if (def === true || def === undefined || def === null) {
|
|
495
|
-
return inline(PRELUDE.Document, false);
|
|
496
|
-
}
|
|
497
|
-
if (typeof def !== "object")
|
|
498
|
-
return inline(PRELUDE.Document, false);
|
|
499
|
-
// --- $ref → named (or cached inline) shape --------------------------------
|
|
500
|
-
if (def.$ref) {
|
|
501
|
-
// Sibling nullability next to the $ref (common tool output even where
|
|
502
|
-
// the spec says siblings are ignored) survives onto the member.
|
|
503
|
-
const siteNullable = ownNullable(ctx, def);
|
|
504
|
-
// Direction-sensitive components (readOnly members in request position,
|
|
505
|
-
// writeOnly in response position) get per-direction variants; the rest
|
|
506
|
-
// share one shape across both directions.
|
|
507
|
-
const sensitive = dirSensitive(ctx, def, dir);
|
|
508
|
-
const cacheKey = sensitive ? `${dir}:${def.$ref}` : `*:${def.$ref}`;
|
|
509
|
-
const cached = ctx.refs.get(cacheKey);
|
|
510
|
-
if (cached)
|
|
511
|
-
return inline(cached.target, cached.nullable || siteNullable);
|
|
512
|
-
const resolved = resolvePointer(ctx.spec, def.$ref);
|
|
513
|
-
if (resolved === undefined)
|
|
514
|
-
return inline(PRELUDE.Document, siteNullable);
|
|
515
|
-
const refName = (String(def.$ref).split("/").pop() ?? "Shape") +
|
|
516
|
-
(sensitive ? (dir === "in" ? "Input" : "Output") : "");
|
|
517
|
-
if (!isNameable(ctx, resolved)) {
|
|
518
|
-
// Scalars and aliases can't cycle — convert inline and cache.
|
|
519
|
-
const entry = { target: PRELUDE.Document, nullable: false };
|
|
520
|
-
ctx.refs.set(cacheKey, entry);
|
|
521
|
-
const r = convertSchema(ctx, resolved, pascal(refName), depth + 1, dir);
|
|
522
|
-
entry.target = r.target;
|
|
523
|
-
entry.nullable = r.nullable;
|
|
524
|
-
return inline(r.target, r.nullable || siteNullable);
|
|
525
|
-
}
|
|
526
|
-
// Reserve the component name before converting so cycles resolve.
|
|
527
|
-
const id = `${ctx.ns}#${uniqueName(ctx, refName)}`;
|
|
528
|
-
const entry = { target: id, nullable: false };
|
|
529
|
-
ctx.refs.set(cacheKey, entry);
|
|
530
|
-
ctx.shapes[id] = { type: "structure", members: {} }; // placeholder
|
|
531
|
-
const r = convertSchema(ctx, resolved, pascal(refName), depth + 1, dir, id);
|
|
532
|
-
entry.target = r.target;
|
|
533
|
-
entry.nullable = r.nullable;
|
|
534
|
-
return inline(r.target, r.nullable || siteNullable);
|
|
535
|
-
}
|
|
536
|
-
let nullable = ownNullable(ctx, def);
|
|
537
|
-
const doc = typeof def.description === "string" ? def.description : undefined;
|
|
538
|
-
const docTraits = doc ? { "smithy.api#documentation": doc } : {};
|
|
539
|
-
// --- oneOf / anyOf --------------------------------------------------------
|
|
540
|
-
const branches = def.oneOf ?? def.anyOf;
|
|
541
|
-
if (Array.isArray(branches)) {
|
|
542
|
-
const real = [];
|
|
543
|
-
for (const b of branches) {
|
|
544
|
-
if (isNullBranch(ctx, b))
|
|
545
|
-
nullable = true;
|
|
546
|
-
else
|
|
547
|
-
real.push(b);
|
|
548
|
-
}
|
|
549
|
-
if (real.length === 0)
|
|
550
|
-
return inline(PRELUDE.Document, nullable);
|
|
551
|
-
if (real.length === 1) {
|
|
552
|
-
const r = convertSchema(ctx, real[0], hint, depth + 1, dir, reservedId);
|
|
553
|
-
return { target: r.target, nullable: nullable || r.nullable };
|
|
554
|
-
}
|
|
555
|
-
// Distinct branches → a union shape. Members are synthesized case names;
|
|
556
|
-
// duplicate targets are deduped.
|
|
557
|
-
const members = {};
|
|
558
|
-
const seenTargets = new Set();
|
|
559
|
-
real.forEach((b, i) => {
|
|
560
|
-
const branchName = typeof b?.$ref === "string"
|
|
561
|
-
? pascal(String(b.$ref).split("/").pop() ?? `Case${i}`)
|
|
562
|
-
: `Case${i}`;
|
|
563
|
-
const r = convertSchema(ctx, b, `${hint}${branchName}`, depth + 1, dir);
|
|
564
|
-
if (seenTargets.has(r.target))
|
|
565
|
-
return;
|
|
566
|
-
seenTargets.add(r.target);
|
|
567
|
-
let mn = memberIdent(branchName);
|
|
568
|
-
let k = 2;
|
|
569
|
-
while (mn in members)
|
|
570
|
-
mn = `${memberIdent(branchName)}_${k++}`;
|
|
571
|
-
members[mn] = { target: r.target };
|
|
572
|
-
});
|
|
573
|
-
const targets = Object.values(members);
|
|
574
|
-
if (targets.length === 1) {
|
|
575
|
-
return inline(targets[0].target, nullable);
|
|
576
|
-
}
|
|
577
|
-
return {
|
|
578
|
-
target: emit({ type: "union", members, traits: docTraits }, hint),
|
|
579
|
-
nullable,
|
|
580
|
-
};
|
|
581
|
-
}
|
|
582
|
-
// --- allOf ----------------------------------------------------------------
|
|
583
|
-
if (Array.isArray(def.allOf)) {
|
|
584
|
-
// Single-entry allOf over a $ref: passthrough (v0 semantics), carrying
|
|
585
|
-
// the parent's nullability/description.
|
|
586
|
-
if (def.allOf.length === 1 && !def.properties) {
|
|
587
|
-
const r = convertSchema(ctx, def.allOf[0], hint, depth + 1, dir, reservedId);
|
|
588
|
-
return { target: r.target, nullable: nullable || r.nullable };
|
|
589
|
-
}
|
|
590
|
-
const flat = flattenObject(ctx, def, depth);
|
|
591
|
-
if (Object.keys(flat.properties).length === 0) {
|
|
592
|
-
// A property-less intersection of map schemas is a map, not an empty
|
|
593
|
-
// struct.
|
|
594
|
-
if (flat.additionalProperties !== undefined) {
|
|
595
|
-
const r = convertSchema(ctx, { type: "object", additionalProperties: flat.additionalProperties }, hint, depth + 1, dir, reservedId);
|
|
596
|
-
return { target: r.target, nullable: nullable || r.nullable };
|
|
597
|
-
}
|
|
598
|
-
if (!flat.isObject)
|
|
599
|
-
return inline(PRELUDE.Document, nullable);
|
|
600
|
-
}
|
|
601
|
-
const members = buildMembers(ctx, flat.properties, flat.required, hint, depth + 1, dir);
|
|
602
|
-
return {
|
|
603
|
-
target: emit({ type: "structure", members, traits: structTraits(docTraits, flat.additionalProperties) }, hint),
|
|
604
|
-
nullable,
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
// --- enum -----------------------------------------------------------------
|
|
608
|
-
if (Array.isArray(def.enum) && def.enum.length > 0) {
|
|
609
|
-
const values = def.enum.filter((v) => v !== null);
|
|
610
|
-
if (values.some((v) => v === null))
|
|
611
|
-
nullable = true;
|
|
612
|
-
if (values.length === 0)
|
|
613
|
-
return inline(PRELUDE.Document, true);
|
|
614
|
-
if (values.every((v) => typeof v === "string")) {
|
|
615
|
-
const members = {};
|
|
616
|
-
const used = new Set();
|
|
617
|
-
for (const lit of values) {
|
|
618
|
-
let mn = enumMemberName(lit);
|
|
619
|
-
let k = 2;
|
|
620
|
-
while (used.has(mn))
|
|
621
|
-
mn = `${enumMemberName(lit)}_${k++}`;
|
|
622
|
-
used.add(mn);
|
|
623
|
-
members[mn] = {
|
|
624
|
-
target: PRELUDE.Unit,
|
|
625
|
-
traits: { "smithy.api#enumValue": lit },
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
return {
|
|
629
|
-
target: emit({ type: "enum", members, traits: docTraits }, hint),
|
|
630
|
-
nullable,
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
// Numeric enums → intEnum shapes (closed numeric literal unions in the
|
|
634
|
-
// generated TS; the schema stays a plain number).
|
|
635
|
-
if (values.every((v) => typeof v === "number")) {
|
|
636
|
-
const members = {};
|
|
637
|
-
const used = new Set();
|
|
638
|
-
for (const lit of values) {
|
|
639
|
-
let mn = enumMemberName(String(lit));
|
|
640
|
-
let k = 2;
|
|
641
|
-
while (used.has(mn))
|
|
642
|
-
mn = `${enumMemberName(String(lit))}_${k++}`;
|
|
643
|
-
used.add(mn);
|
|
644
|
-
members[mn] = {
|
|
645
|
-
target: PRELUDE.Unit,
|
|
646
|
-
traits: { "smithy.api#enumValue": lit },
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
return {
|
|
650
|
-
target: emit({ type: "intEnum", members, traits: docTraits }, hint),
|
|
651
|
-
nullable,
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
if (values.every((v) => typeof v === "boolean")) {
|
|
655
|
-
return inline(PRELUDE.Boolean, nullable);
|
|
656
|
-
}
|
|
657
|
-
return inline(PRELUDE.Document, nullable);
|
|
658
|
-
}
|
|
659
|
-
const t = typeOf(def);
|
|
660
|
-
// --- array ----------------------------------------------------------------
|
|
661
|
-
if (t === "array") {
|
|
662
|
-
const item = convertSchema(ctx, def.items, `${hint}Item`, depth + 1, dir);
|
|
663
|
-
return {
|
|
664
|
-
target: emit({
|
|
665
|
-
type: "list",
|
|
666
|
-
member: {
|
|
667
|
-
target: item.target,
|
|
668
|
-
...(item.nullable ? { traits: { [NULLABLE_TRAIT]: {} } } : {}),
|
|
669
|
-
},
|
|
670
|
-
traits: docTraits,
|
|
671
|
-
}, reservedId !== undefined ? hint : `${hint}List`),
|
|
672
|
-
nullable,
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
// --- object ---------------------------------------------------------------
|
|
676
|
-
if (t === "object" || def.properties || def.additionalProperties) {
|
|
677
|
-
if (def.properties && Object.keys(def.properties).length > 0) {
|
|
678
|
-
const required = new Set(Array.isArray(def.required) ? def.required : []);
|
|
679
|
-
const members = buildMembers(ctx, def.properties, required, hint, depth + 1, dir);
|
|
680
|
-
return {
|
|
681
|
-
target: emit({
|
|
682
|
-
type: "structure",
|
|
683
|
-
members,
|
|
684
|
-
traits: structTraits(docTraits, def.additionalProperties),
|
|
685
|
-
}, hint),
|
|
686
|
-
nullable,
|
|
687
|
-
};
|
|
688
|
-
}
|
|
689
|
-
const ap = def.additionalProperties;
|
|
690
|
-
if (ap !== undefined && ap !== false) {
|
|
691
|
-
const value = ap === true || (typeof ap === "object" && Object.keys(ap).length === 0)
|
|
692
|
-
? { target: PRELUDE.Document, nullable: false }
|
|
693
|
-
: convertSchema(ctx, ap, `${hint}Value`, depth + 1, dir);
|
|
694
|
-
return {
|
|
695
|
-
target: emit({
|
|
696
|
-
type: "map",
|
|
697
|
-
key: { target: PRELUDE.String },
|
|
698
|
-
value: {
|
|
699
|
-
target: value.target,
|
|
700
|
-
...(value.nullable ? { traits: { [NULLABLE_TRAIT]: {} } } : {}),
|
|
701
|
-
},
|
|
702
|
-
traits: docTraits,
|
|
703
|
-
}, reservedId !== undefined ? hint : `${hint}Map`),
|
|
704
|
-
nullable,
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
return inline(PRELUDE.Document, nullable);
|
|
708
|
-
}
|
|
709
|
-
// --- scalars --------------------------------------------------------------
|
|
710
|
-
switch (t) {
|
|
711
|
-
case "string":
|
|
712
|
-
return inline(ctx.binaryTypes && def.format === "binary" ? PRELUDE.Blob : PRELUDE.String, nullable);
|
|
713
|
-
case "boolean":
|
|
714
|
-
return inline(PRELUDE.Boolean, nullable);
|
|
715
|
-
case "integer":
|
|
716
|
-
return inline(PRELUDE.Integer, nullable);
|
|
717
|
-
case "number":
|
|
718
|
-
return inline(PRELUDE.Double, nullable);
|
|
719
|
-
case "null":
|
|
720
|
-
return inline(PRELUDE.Document, true);
|
|
721
|
-
default:
|
|
722
|
-
return inline(PRELUDE.Document, nullable);
|
|
723
|
-
}
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
const structTraits = (docTraits, ap) => ap !== undefined && ap !== false
|
|
732
|
-
? { ...docTraits, [ADDITIONAL_PROPERTIES_TRAIT]: {} }
|
|
733
|
-
: docTraits;
|
|
734
|
-
|
|
735
|
-
const isSensitiveProperty = (ctx, name, def) => {
|
|
736
|
-
const r = deref(ctx, def);
|
|
737
|
-
if (!r || typeof r !== "object")
|
|
738
|
-
return false;
|
|
739
|
-
const isString = typeOf(r) === "string" && !Array.isArray(r.enum);
|
|
740
|
-
if (!isString)
|
|
741
|
-
return false;
|
|
742
|
-
if (r["x-sensitive"] === true || def?.["x-sensitive"] === true)
|
|
743
|
-
return true;
|
|
744
|
-
return ctx.sensitivePatterns.some((p) => p.test(name));
|
|
745
|
-
};
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
const buildMembers = (ctx, properties, required, hint, depth, dir) => {
|
|
752
|
-
const members = {};
|
|
753
|
-
for (const [name, prop] of Object.entries(properties)) {
|
|
754
|
-
if (dirExcluded(ctx, prop, dir))
|
|
755
|
-
continue;
|
|
756
|
-
let mn = memberIdent(name);
|
|
757
|
-
let k = 2;
|
|
758
|
-
while (mn in members)
|
|
759
|
-
mn = `${memberIdent(name)}_${k++}`;
|
|
760
|
-
const conv = convertSchema(ctx, prop, `${hint}${pascal(name)}`, depth, dir);
|
|
761
|
-
const traits = {};
|
|
762
|
-
const doc = prop && typeof prop === "object" && typeof prop.description === "string"
|
|
763
|
-
? prop.description
|
|
764
|
-
: undefined;
|
|
765
|
-
if (doc)
|
|
766
|
-
traits["smithy.api#documentation"] = doc;
|
|
767
|
-
if (required.has(name))
|
|
768
|
-
traits["smithy.api#required"] = {};
|
|
769
|
-
if (mn !== name)
|
|
770
|
-
traits["smithy.api#jsonName"] = name;
|
|
771
|
-
if (conv.nullable)
|
|
772
|
-
traits[NULLABLE_TRAIT] = {};
|
|
773
|
-
if (isSensitiveProperty(ctx, name, prop)) {
|
|
774
|
-
traits["smithy.api#sensitive"] = {};
|
|
775
|
-
}
|
|
776
|
-
members[mn] = {
|
|
777
|
-
target: conv.target,
|
|
778
|
-
...(Object.keys(traits).length ? { traits } : {}),
|
|
779
|
-
};
|
|
780
|
-
}
|
|
781
|
-
return members;
|
|
782
|
-
};
|
|
783
|
-
|
|
784
|
-
const normalizeParam = (ctx, raw) => {
|
|
785
|
-
const p = raw?.$ref ? resolvePointer(ctx.spec, raw.$ref) : raw;
|
|
786
|
-
if (!p || typeof p !== "object" || typeof p.name !== "string") {
|
|
787
|
-
return undefined;
|
|
788
|
-
}
|
|
789
|
-
// Swagger 2.0: `in: body` parameters carry their (usually `$ref`'d)
|
|
790
|
-
// schema under `schema`; all other locations describe the type inline on
|
|
791
|
-
// the parameter itself.
|
|
792
|
-
const schema = ctx.version === "2.0"
|
|
793
|
-
? p.in === "body"
|
|
794
|
-
? (p.schema ?? {})
|
|
795
|
-
: {
|
|
796
|
-
type: p.type,
|
|
797
|
-
enum: p.enum,
|
|
798
|
-
items: p.items,
|
|
799
|
-
format: p.format,
|
|
800
|
-
"x-nullable": p["x-nullable"],
|
|
801
|
-
}
|
|
802
|
-
: (p.schema ?? { type: "string" });
|
|
803
|
-
return {
|
|
804
|
-
in: p.in,
|
|
805
|
-
name: p.name,
|
|
806
|
-
required: p.required === true || p.in === "path",
|
|
807
|
-
description: typeof p.description === "string" ? p.description : undefined,
|
|
808
|
-
schema,
|
|
809
|
-
};
|
|
810
|
-
};
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
const collectParams = (ctx, pathItem, op) => {
|
|
818
|
-
const byKey = new Map();
|
|
819
|
-
for (const raw of [
|
|
820
|
-
...(Array.isArray(pathItem?.parameters) ? pathItem.parameters : []),
|
|
821
|
-
...(Array.isArray(op?.parameters) ? op.parameters : []),
|
|
822
|
-
]) {
|
|
823
|
-
const p = normalizeParam(ctx, raw);
|
|
824
|
-
if (!p)
|
|
825
|
-
continue;
|
|
826
|
-
byKey.set(`${p.in}${p.name}`, p);
|
|
827
|
-
}
|
|
828
|
-
return [...byKey.values()].filter((p) => p.in === "path" || p.in === "query" || p.in === "body" || p.in === "header");
|
|
829
|
-
};
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
const labelTarget = (ctx, schema, hint) => {
|
|
836
|
-
const r = deref(ctx, schema);
|
|
837
|
-
if (Array.isArray(r?.enum) &&
|
|
838
|
-
r.enum.length > 0 &&
|
|
839
|
-
r.enum.every((v) => typeof v === "string")) {
|
|
840
|
-
return convertSchema(ctx, r, hint, 0, "in").target;
|
|
841
|
-
}
|
|
842
|
-
switch (typeOf(r)) {
|
|
843
|
-
case "integer":
|
|
844
|
-
return PRELUDE.Integer;
|
|
845
|
-
case "number":
|
|
846
|
-
return PRELUDE.Double;
|
|
847
|
-
case "boolean":
|
|
848
|
-
return PRELUDE.Boolean;
|
|
849
|
-
default:
|
|
850
|
-
return PRELUDE.String;
|
|
851
|
-
}
|
|
852
|
-
};
|
|
853
|
-
// ============================================================================
|
|
854
|
-
// Docs
|
|
855
|
-
// ============================================================================
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
const trimDescription = (desc) => {
|
|
861
|
-
if (typeof desc !== "string" || !desc)
|
|
862
|
-
return undefined;
|
|
863
|
-
const lines = [];
|
|
864
|
-
for (const line of desc.split(/\r?\n/)) {
|
|
865
|
-
if (line.trim().startsWith("### Authorization"))
|
|
866
|
-
break;
|
|
867
|
-
if (line.trim().startsWith("|"))
|
|
868
|
-
continue;
|
|
869
|
-
lines.push(line);
|
|
870
|
-
}
|
|
871
|
-
const out = lines.join("\n").trim();
|
|
872
|
-
return out || undefined;
|
|
873
|
-
};
|
|
874
|
-
const opDoc = (op) => {
|
|
875
|
-
const summary = typeof op.summary === "string" ? op.summary.trim() : undefined;
|
|
876
|
-
const desc = trimDescription(op.description);
|
|
877
|
-
const parts = [summary, desc].filter((s) => s !== undefined && s !== "");
|
|
878
|
-
return parts.length ? parts.join("\n\n") : undefined;
|
|
879
|
-
};
|
|
880
|
-
// ============================================================================
|
|
881
|
-
// Responses
|
|
882
|
-
// ============================================================================
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
const successHeaders = (ctx, responses, allowed) => {
|
|
889
|
-
const out = [];
|
|
890
|
-
const seen = new Set();
|
|
891
|
-
for (const code of Object.keys(responses ?? {}).sort()) {
|
|
892
|
-
if (!/^2\d\d$/.test(code))
|
|
893
|
-
continue;
|
|
894
|
-
const raw = responses[code];
|
|
895
|
-
const resp = raw?.$ref ? resolvePointer(ctx.spec, raw.$ref) : raw;
|
|
896
|
-
for (const [name, rawHeader] of Object.entries(resp?.headers ?? {})) {
|
|
897
|
-
const lower = name.toLowerCase();
|
|
898
|
-
if (!allowed.has(lower) || seen.has(lower))
|
|
899
|
-
continue;
|
|
900
|
-
seen.add(lower);
|
|
901
|
-
const header = rawHeader?.$ref ? resolvePointer(ctx.spec, rawHeader.$ref) : rawHeader;
|
|
902
|
-
if (!header || typeof header !== "object")
|
|
903
|
-
continue;
|
|
904
|
-
out.push({
|
|
905
|
-
name,
|
|
906
|
-
schema: ctx.version === "2.0" ? header : (header.schema ?? {}),
|
|
907
|
-
...(typeof header.description === "string" ? { description: header.description } : {}),
|
|
908
|
-
});
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
return out;
|
|
912
|
-
};
|
|
913
|
-
|
|
914
|
-
const targetCounts = (shapes) => {
|
|
915
|
-
const counts = new Map();
|
|
916
|
-
const visit = (node) => {
|
|
917
|
-
if (node === null || typeof node !== "object")
|
|
918
|
-
return;
|
|
919
|
-
if (Array.isArray(node)) {
|
|
920
|
-
for (const item of node)
|
|
921
|
-
visit(item);
|
|
922
|
-
return;
|
|
923
|
-
}
|
|
924
|
-
if (typeof node.target === "string") {
|
|
925
|
-
counts.set(node.target, (counts.get(node.target) ?? 0) + 1);
|
|
926
|
-
}
|
|
927
|
-
for (const [key, value] of Object.entries(node)) {
|
|
928
|
-
if (key !== "traits")
|
|
929
|
-
visit(value);
|
|
930
|
-
}
|
|
931
|
-
};
|
|
932
|
-
for (const shape of Object.values(shapes))
|
|
933
|
-
visit(shape);
|
|
934
|
-
return counts;
|
|
935
|
-
};
|
|
936
|
-
|
|
937
|
-
const successSchema = (ctx, responses, order) => {
|
|
938
|
-
for (const code of order) {
|
|
939
|
-
const raw = responses?.[code];
|
|
940
|
-
if (!raw)
|
|
941
|
-
continue;
|
|
942
|
-
const resp = raw.$ref ? resolvePointer(ctx.spec, raw.$ref) : raw;
|
|
943
|
-
if (!resp || typeof resp !== "object")
|
|
944
|
-
return { schema: undefined };
|
|
945
|
-
if (ctx.version === "2.0") {
|
|
946
|
-
return { schema: resp.schema };
|
|
947
|
-
}
|
|
948
|
-
const json = resp.content?.["application/json"]?.schema;
|
|
949
|
-
const binary = resp.content?.["application/octet-stream"]?.schema;
|
|
950
|
-
return {
|
|
951
|
-
schema: json ?? (ctx.binaryTypes && deref(ctx, binary)?.format === "binary" ? binary : undefined),
|
|
952
|
-
};
|
|
953
|
-
}
|
|
954
|
-
return { schema: undefined };
|
|
955
|
-
};
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
const responseIsCollection = (ctx, responses, order) => {
|
|
962
|
-
const { schema } = successSchema(ctx, responses, order);
|
|
963
|
-
if (!schema)
|
|
964
|
-
return undefined;
|
|
965
|
-
const s = deref(ctx, schema);
|
|
966
|
-
if (!s || typeof s !== "object")
|
|
967
|
-
return undefined;
|
|
968
|
-
if (s.type === "array" || s.items)
|
|
969
|
-
return true;
|
|
970
|
-
const props = s.properties;
|
|
971
|
-
if (!props || typeof props !== "object") {
|
|
972
|
-
return s.allOf || s.oneOf || s.anyOf ? undefined : false;
|
|
973
|
-
}
|
|
974
|
-
let arrays = 0;
|
|
975
|
-
let others = 0;
|
|
976
|
-
for (const prop of Object.values(props)) {
|
|
977
|
-
const p = deref(ctx, prop);
|
|
978
|
-
if (p?.type === "array" || p?.items)
|
|
979
|
-
arrays++;
|
|
980
|
-
else
|
|
981
|
-
others++;
|
|
982
|
-
}
|
|
983
|
-
if (arrays === 0)
|
|
984
|
-
return false;
|
|
985
|
-
// `{ data: [...] }`, `{ items, next_cursor }`, `{ results, count, page }`
|
|
986
|
-
return arrays >= 1 && others <= 3;
|
|
987
|
-
};
|
|
988
|
-
const PAGINATION_INPUT_ALIASES = {
|
|
989
|
-
cursor: ["cursor", "page_token", "pageToken"],
|
|
990
|
-
token: ["next_token", "NextToken", "nextToken"],
|
|
991
|
-
page: ["page"],
|
|
992
|
-
};
|
|
993
|
-
const detectPagination = (ctx, params, responseSchema) => {
|
|
994
|
-
if (!responseSchema)
|
|
995
|
-
return undefined;
|
|
996
|
-
const bag = flattenObject(ctx, responseSchema).properties;
|
|
997
|
-
if (Object.keys(bag).length === 0)
|
|
998
|
-
return undefined;
|
|
999
|
-
let mode;
|
|
1000
|
-
let outputToken;
|
|
1001
|
-
const pag = bag["pagination"] ? flattenObject(ctx, bag["pagination"]).properties : undefined;
|
|
1002
|
-
if (pag?.["cursor"]) {
|
|
1003
|
-
mode = "cursor";
|
|
1004
|
-
outputToken = "pagination.cursor";
|
|
1005
|
-
}
|
|
1006
|
-
else if (pag?.["next"]) {
|
|
1007
|
-
mode = "cursor";
|
|
1008
|
-
outputToken = "pagination.next";
|
|
1009
|
-
}
|
|
1010
|
-
else if (pag?.["next_page"]) {
|
|
1011
|
-
mode = "page";
|
|
1012
|
-
outputToken = "pagination.next_page";
|
|
1013
|
-
}
|
|
1014
|
-
else if (bag["next_token"]) {
|
|
1015
|
-
mode = "token";
|
|
1016
|
-
outputToken = "next_token";
|
|
1017
|
-
}
|
|
1018
|
-
else if (bag["NextToken"]) {
|
|
1019
|
-
mode = "token";
|
|
1020
|
-
outputToken = "NextToken";
|
|
1021
|
-
}
|
|
1022
|
-
else if (bag["nextToken"]) {
|
|
1023
|
-
mode = "token";
|
|
1024
|
-
outputToken = "nextToken";
|
|
1025
|
-
}
|
|
1026
|
-
else if (bag["next_page"]) {
|
|
1027
|
-
mode = "page";
|
|
1028
|
-
outputToken = "next_page";
|
|
1029
|
-
}
|
|
1030
|
-
if (!mode || !outputToken)
|
|
1031
|
-
return undefined;
|
|
1032
|
-
const aliases = PAGINATION_INPUT_ALIASES[mode];
|
|
1033
|
-
const inputToken = params.find((p) => p.in === "query" && aliases.includes(p.name))?.name;
|
|
1034
|
-
if (!inputToken)
|
|
1035
|
-
return undefined;
|
|
1036
|
-
let items;
|
|
1037
|
-
for (const [k, v] of Object.entries(bag)) {
|
|
1038
|
-
if (k === "pagination" || k === "next_token" || k === "NextToken")
|
|
1039
|
-
continue;
|
|
1040
|
-
if (typeOf(deref(ctx, v)) === "array") {
|
|
1041
|
-
items = k;
|
|
1042
|
-
break;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
if (!items)
|
|
1046
|
-
return undefined;
|
|
1047
|
-
return { mode, inputToken, outputToken, items };
|
|
1048
|
-
};
|
|
1049
|
-
// ============================================================================
|
|
1050
|
-
// Main conversion
|
|
1051
|
-
// ============================================================================
|
|
1052
|
-
const HTTP_METHODS = ["get", "post", "put", "patch", "delete"];
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
const OPTIONAL_HTTP_METHODS = ["head", "options"];
|
|
1060
|
-
const DEFAULT_STATUS_TO_ERROR_CLASS = {
|
|
1061
|
-
"400": "BadRequest",
|
|
1062
|
-
"403": "Forbidden",
|
|
1063
|
-
"404": "NotFound",
|
|
1064
|
-
"409": "Conflict",
|
|
1065
|
-
"422": "UnprocessableEntity",
|
|
1066
|
-
};
|
|
1067
|
-
const DEFAULT_ERROR_STATUSES = ["401", "429", "500", "503"];
|
|
1068
|
-
const DEFAULT_SUCCESS_STATUSES = ["200", "201", "204"];
|
|
1069
|
-
export { RENAME_METADATA_KEY };
|
|
1070
|
-
export const convertOpenApiToSmithy = (spec, options) => {
|
|
1071
|
-
const named = convertOnce(spec, options);
|
|
1072
|
-
if (!options.deferNaming)
|
|
1073
|
-
return named;
|
|
1074
|
-
const upstream = convertOnce(spec, {
|
|
1075
|
-
...options,
|
|
1076
|
-
operationNaming: "as-is",
|
|
1077
|
-
operationNames: undefined,
|
|
1078
|
-
});
|
|
1079
|
-
// Names never steer the conversion (only uniqueness suffixes and the
|
|
1080
|
-
// `By<Param>` rule read them), so both runs create the same shapes in the
|
|
1081
|
-
// same order: the i-th shape of one is the i-th of the other.
|
|
1082
|
-
const from = Object.keys(upstream.shapes);
|
|
1083
|
-
const to = Object.keys(named.shapes);
|
|
1084
|
-
if (from.length !== to.length) {
|
|
1085
|
-
throw new Error(`deferNaming (${options.namespace}): ${from.length} shapes with upstream names, ${to.length} with final names`);
|
|
1086
|
-
}
|
|
1087
|
-
const rename = {};
|
|
1088
|
-
for (let i = 0; i < from.length; i++)
|
|
1089
|
-
if (from[i] !== to[i])
|
|
1090
|
-
rename[from[i]] = to[i];
|
|
1091
|
-
const check = structuredClone(upstream);
|
|
1092
|
-
renameShapes(check, new Map(Object.entries(rename)));
|
|
1093
|
-
if (JSON.stringify(check) !== JSON.stringify(named)) {
|
|
1094
|
-
const differs = to.find((id) => JSON.stringify(check.shapes[id]) !== JSON.stringify(named.shapes[id]));
|
|
1095
|
-
throw new Error(`deferNaming (${options.namespace}): the upstream-named model does not rename to the final one (first difference: ${differs ?? "metadata"})`);
|
|
1096
|
-
}
|
|
1097
|
-
if (Object.keys(rename).length > 0) {
|
|
1098
|
-
upstream.metadata = { ...upstream.metadata, [RENAME_METADATA_KEY]: rename };
|
|
1099
|
-
}
|
|
1100
|
-
return upstream;
|
|
1101
|
-
};
|
|
1102
|
-
const convertOnce = (spec, options) => {
|
|
1103
|
-
const doc = spec;
|
|
1104
|
-
const version = detectVersion(doc);
|
|
1105
|
-
const ctx = {
|
|
1106
|
-
spec: doc,
|
|
1107
|
-
version,
|
|
1108
|
-
ns: options.namespace,
|
|
1109
|
-
shapes: {},
|
|
1110
|
-
names: new Set(),
|
|
1111
|
-
refs: new Map(),
|
|
1112
|
-
dirSensitiveRefs: new Map(),
|
|
1113
|
-
sensitivePatterns: options.sensitivePatterns ?? SENSITIVE_FIELD_PATTERNS,
|
|
1114
|
-
binaryTypes: options.binaryTypes ?? false,
|
|
1115
|
-
};
|
|
1116
|
-
const statusToErrorClass = options.statusToErrorClass ?? DEFAULT_STATUS_TO_ERROR_CLASS;
|
|
1117
|
-
const defaultErrorStatuses = new Set(options.defaultErrorStatuses ?? DEFAULT_ERROR_STATUSES);
|
|
1118
|
-
const skipDeprecated = options.skipDeprecated ?? true;
|
|
1119
|
-
const successStatuses = options.successStatuses ?? DEFAULT_SUCCESS_STATUSES;
|
|
1120
|
-
const httpMethods = [
|
|
1121
|
-
...HTTP_METHODS,
|
|
1122
|
-
...OPTIONAL_HTTP_METHODS.filter((m) => options.extraHttpMethods?.includes(m)),
|
|
1123
|
-
];
|
|
1124
|
-
// Error class names and the service name are reserved up front so schema
|
|
1125
|
-
// components can never steal them.
|
|
1126
|
-
const errorIds = new Map(); // class name → shape id
|
|
1127
|
-
for (const cls of new Set(Object.values(statusToErrorClass))) {
|
|
1128
|
-
errorIds.set(cls, `${ctx.ns}#${uniqueName(ctx, cls)}`);
|
|
1129
|
-
}
|
|
1130
|
-
const serviceName = uniqueName(ctx, options.serviceName);
|
|
1131
|
-
const usedErrors = new Map(); // class name → first status
|
|
1132
|
-
const serviceOps = [];
|
|
1133
|
-
const componentHeaders = [];
|
|
1134
|
-
const allowedResponseHeaders = new Set((options.responseHeaders ?? []).map((name) => name.toLowerCase()));
|
|
1135
|
-
for (const [rawPath, pathItem] of Object.entries(doc.paths ?? {})) {
|
|
1136
|
-
if (!pathItem || typeof pathItem !== "object")
|
|
1137
|
-
continue;
|
|
1138
|
-
for (const method of httpMethods) {
|
|
1139
|
-
const op = pathItem[method];
|
|
1140
|
-
if (!op || typeof op !== "object")
|
|
1141
|
-
continue;
|
|
1142
|
-
if (skipDeprecated && op.deprecated === true)
|
|
1143
|
-
continue;
|
|
1144
|
-
const rawOperationId = typeof op.operationId === "string" && op.operationId
|
|
1145
|
-
? op.operationId
|
|
1146
|
-
: `${method}_${rawPath}`;
|
|
1147
|
-
const idCtx = { path: rawPath, method };
|
|
1148
|
-
const naming = options.operationNaming ?? "verbNoun";
|
|
1149
|
-
let named = options.operationNames !== undefined
|
|
1150
|
-
? resolveOperationName(options.operationNames, rawOperationId, idCtx)
|
|
1151
|
-
: undefined;
|
|
1152
|
-
if (named === undefined && naming === "verbNoun") {
|
|
1153
|
-
// A mechanical id (`get-api-card`, or none at all) is named from
|
|
1154
|
-
// the route. A hand-chosen one that merely starts with the method
|
|
1155
|
-
// and reads the route in order (`get-feeds` on /feeds) keeps its
|
|
1156
|
-
// own nouns; only the HTTP-method verb is normalised.
|
|
1157
|
-
if (typeof op.operationId !== "string" || !op.operationId) {
|
|
1158
|
-
// No id: everything comes from the route, including whether a
|
|
1159
|
-
// GET on a collection route is `list` or `get`.
|
|
1160
|
-
named = pathToVerbNoun(idCtx, {
|
|
1161
|
-
returnsCollection: responseIsCollection(ctx, op.responses, successStatuses),
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
|
-
else if (isMechanicalOperationId(op.operationId, idCtx)) {
|
|
1165
|
-
// Method-prefixed and reading the route (`get-feeds`,
|
|
1166
|
-
// `postV1AppsByAppIdPromote`, `deleteProjectJWKS`): keep the
|
|
1167
|
-
// author's tokens and casing; normalise `post`/`patch`, drop
|
|
1168
|
-
// parameter clauses (`ByAppId`, `ById`) and api/version roots.
|
|
1169
|
-
named = pathToVerbNoun(idCtx, {
|
|
1170
|
-
nouns: op.operationId,
|
|
1171
|
-
verbatim: isVerbatimRouteId(op.operationId, idCtx),
|
|
1172
|
-
});
|
|
1173
|
-
}
|
|
1174
|
-
else {
|
|
1175
|
-
named = toVerbNoun(rawOperationId);
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
let resolved = named ?? rawOperationId;
|
|
1179
|
-
// Two routes can derive the same name (`/collections/{slug}` and
|
|
1180
|
-
// `/collections/{slug}-{id}`); suffix the trailing parameter rather
|
|
1181
|
-
// than a counter.
|
|
1182
|
-
if (naming === "verbNoun" &&
|
|
1183
|
-
ctx.names.has(pascal(resolved)) &&
|
|
1184
|
-
isMechanicalOperationId(typeof op.operationId === "string" ? op.operationId : undefined, idCtx)) {
|
|
1185
|
-
const lastParam = /\{([^}]+)\}[^/]*$/.exec(rawPath)?.[1];
|
|
1186
|
-
if (lastParam)
|
|
1187
|
-
resolved = `${resolved}By${pascal(lastParam)}`;
|
|
1188
|
-
}
|
|
1189
|
-
const opName = pascal(resolved);
|
|
1190
|
-
const params = collectParams(ctx, pathItem, op);
|
|
1191
|
-
// ---- URI + labels (sanitize placeholder names to member idents) ----
|
|
1192
|
-
let uri = rawPath.split(/[?#]/)[0];
|
|
1193
|
-
const rawLabels = Array.from(uri.matchAll(/\{([^}]+)\}/g)).map((m) => m[1]);
|
|
1194
|
-
const members = {};
|
|
1195
|
-
const addMember = (name, member) => {
|
|
1196
|
-
if (name in members)
|
|
1197
|
-
return false;
|
|
1198
|
-
members[name] = member;
|
|
1199
|
-
return true;
|
|
1200
|
-
};
|
|
1201
|
-
for (const raw of rawLabels) {
|
|
1202
|
-
const san = memberIdent(raw);
|
|
1203
|
-
if (san !== raw)
|
|
1204
|
-
uri = uri.split(`{${raw}}`).join(`{${san}}`);
|
|
1205
|
-
const p = params.find((x) => x.in === "path" && x.name === raw);
|
|
1206
|
-
addMember(san, {
|
|
1207
|
-
target: labelTarget(ctx, p?.schema, `${opName}Request${pascal(san)}`),
|
|
1208
|
-
traits: {
|
|
1209
|
-
"smithy.api#httpLabel": {},
|
|
1210
|
-
"smithy.api#required": {},
|
|
1211
|
-
...(p?.description ? { "smithy.api#documentation": p.description } : {}),
|
|
1212
|
-
},
|
|
1213
|
-
});
|
|
1214
|
-
}
|
|
1215
|
-
// ---- Query params ----
|
|
1216
|
-
for (const p of params) {
|
|
1217
|
-
if (p.in !== "query")
|
|
1218
|
-
continue;
|
|
1219
|
-
if (options.apiVersion !== undefined && p.name === "api-version") {
|
|
1220
|
-
continue;
|
|
1221
|
-
}
|
|
1222
|
-
const san = memberIdent(p.name);
|
|
1223
|
-
const conv = convertSchema(ctx, p.schema, `${opName}Request${pascal(p.name)}`, 0, "in");
|
|
1224
|
-
addMember(san, {
|
|
1225
|
-
target: conv.target,
|
|
1226
|
-
traits: {
|
|
1227
|
-
"smithy.api#httpQuery": p.name,
|
|
1228
|
-
...(p.required ? { "smithy.api#required": {} } : {}),
|
|
1229
|
-
...(p.description ? { "smithy.api#documentation": p.description } : {}),
|
|
1230
|
-
},
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
// ---- Header params (opt-in) ----
|
|
1234
|
-
if (options.headerParams) {
|
|
1235
|
-
for (const p of params) {
|
|
1236
|
-
if (p.in !== "header")
|
|
1237
|
-
continue;
|
|
1238
|
-
const conv = convertSchema(ctx, p.schema, `${opName}Request${pascal(p.name)}`, 0, "in");
|
|
1239
|
-
addMember(headerMemberName(p.name), {
|
|
1240
|
-
target: conv.target,
|
|
1241
|
-
traits: {
|
|
1242
|
-
// The wire name rides on the trait, so the member is free to be
|
|
1243
|
-
// a normal identifier.
|
|
1244
|
-
"smithy.api#httpHeader": p.name,
|
|
1245
|
-
...(p.required ? { "smithy.api#required": {} } : {}),
|
|
1246
|
-
...(p.description ? { "smithy.api#documentation": p.description } : {}),
|
|
1247
|
-
},
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
// ---- Request body (json > form-urlencoded > multipart) ----
|
|
1252
|
-
let contentType;
|
|
1253
|
-
let bodySchema;
|
|
1254
|
-
let bodyRequired = false;
|
|
1255
|
-
if (version === "2.0") {
|
|
1256
|
-
const bodyParam = params.find((p) => p.in === "body");
|
|
1257
|
-
bodySchema = bodyParam?.schema;
|
|
1258
|
-
bodyRequired = bodyParam?.required === true;
|
|
1259
|
-
}
|
|
1260
|
-
else if (op.requestBody) {
|
|
1261
|
-
// A components/requestBodies entry can itself be a $ref to another
|
|
1262
|
-
// (1Password Events: AuditEventsRequest → CursorRequest).
|
|
1263
|
-
const rb = deref(ctx, op.requestBody);
|
|
1264
|
-
bodyRequired = rb?.required === true;
|
|
1265
|
-
const content = rb?.content ?? {};
|
|
1266
|
-
if (content["application/json"]) {
|
|
1267
|
-
bodySchema = content["application/json"].schema;
|
|
1268
|
-
}
|
|
1269
|
-
else if (content["application/x-www-form-urlencoded"]) {
|
|
1270
|
-
bodySchema = content["application/x-www-form-urlencoded"].schema;
|
|
1271
|
-
contentType = "form-urlencoded";
|
|
1272
|
-
}
|
|
1273
|
-
else if (content["multipart/form-data"]) {
|
|
1274
|
-
bodySchema = content["multipart/form-data"].schema;
|
|
1275
|
-
contentType = "multipart";
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
if (bodySchema !== undefined) {
|
|
1279
|
-
const flat = flattenObject(ctx, bodySchema);
|
|
1280
|
-
if (Object.keys(flat.properties).length > 0) {
|
|
1281
|
-
const bodyMembers = buildMembers(ctx, flat.properties, flat.required, `${opName}Request`, 0, "in");
|
|
1282
|
-
for (const [mn, m] of Object.entries(bodyMembers)) {
|
|
1283
|
-
addMember(mn, m); // labels win, then query, then body
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
else {
|
|
1287
|
-
// Non-flattenable body (bare array/scalar/map/union) → sole TYPED
|
|
1288
|
-
// `body` member sent as the entire request body
|
|
1289
|
-
// (`smithy.api#httpPayload`). A schema-less JSON body (empty or
|
|
1290
|
-
// bare-object schema → Document) gets NO body member at all — the
|
|
1291
|
-
// runtime's unknown-key passthrough is the escape hatch, and an
|
|
1292
|
-
// opaque `body: unknown` payload member would swallow the typed
|
|
1293
|
-
// surface.
|
|
1294
|
-
const conv = convertSchema(ctx, bodySchema, `${opName}RequestBody`, 0, "in");
|
|
1295
|
-
if (conv.target !== PRELUDE.Document) {
|
|
1296
|
-
addMember("body", {
|
|
1297
|
-
target: conv.target,
|
|
1298
|
-
traits: {
|
|
1299
|
-
"smithy.api#httpPayload": {},
|
|
1300
|
-
...(bodyRequired ? { "smithy.api#required": {} } : {}),
|
|
1301
|
-
...(conv.nullable ? { [NULLABLE_TRAIT]: {} } : {}),
|
|
1302
|
-
},
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
// ---- Input shape ----
|
|
1308
|
-
const inputTarget = Object.keys(members).length > 0
|
|
1309
|
-
? addShape(ctx, `${opName}Request`, {
|
|
1310
|
-
type: "structure",
|
|
1311
|
-
members,
|
|
1312
|
-
traits: { "smithy.api#input": {} },
|
|
1313
|
-
})
|
|
1314
|
-
: PRELUDE.Unit;
|
|
1315
|
-
// ---- Output shape ----
|
|
1316
|
-
// A HEAD response carries no content, and not merely by convention:
|
|
1317
|
-
// HTTP/1.1 framing terminates it at the end of the header section
|
|
1318
|
-
// "regardless of the header fields present in the message" (RFC 9112
|
|
1319
|
-
// §6.3), so a declared `Content-Length` describes what a GET *would*
|
|
1320
|
-
// return and no body can reach the client. Specs declare one anyway —
|
|
1321
|
-
// Vercel mirrors the GET's schema onto two of its HEAD probes and
|
|
1322
|
-
// gives the other two a bare `{"nullable": true}` — and honouring it
|
|
1323
|
-
// generates an output struct with required members that then fails to
|
|
1324
|
-
// decode against the empty body on every successful call.
|
|
1325
|
-
const { schema: respSchema } = method === "head"
|
|
1326
|
-
? { schema: undefined }
|
|
1327
|
-
: successSchema(ctx, op.responses, successStatuses);
|
|
1328
|
-
let outputTarget = PRELUDE.Unit;
|
|
1329
|
-
if (respSchema !== undefined) {
|
|
1330
|
-
const flat = flattenObject(ctx, respSchema);
|
|
1331
|
-
if (Object.keys(flat.properties).length > 0) {
|
|
1332
|
-
const resolved = deref(ctx, respSchema);
|
|
1333
|
-
const isPlainRef = typeof respSchema.$ref === "string" &&
|
|
1334
|
-
!Array.isArray(resolved?.allOf) &&
|
|
1335
|
-
isNameable(ctx, resolved);
|
|
1336
|
-
if (isPlainRef) {
|
|
1337
|
-
// Reuse the named component shape as the output directly.
|
|
1338
|
-
outputTarget = convertSchema(ctx, respSchema, opName, 0, "out").target;
|
|
1339
|
-
}
|
|
1340
|
-
else {
|
|
1341
|
-
outputTarget = addShape(ctx, `${opName}Response`, {
|
|
1342
|
-
type: "structure",
|
|
1343
|
-
members: buildMembers(ctx, flat.properties, flat.required, `${opName}Response`, 0, "out"),
|
|
1344
|
-
traits: { "smithy.api#output": {} },
|
|
1345
|
-
});
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
else {
|
|
1349
|
-
// Non-flattenable response (bare array/scalar/map/union, or an
|
|
1350
|
-
// opaque object) → wrapper whose sole TYPED member IS the payload;
|
|
1351
|
-
// the SdkSpec's rootPipe collapses the wrapper.
|
|
1352
|
-
const conv = convertSchema(ctx, respSchema, `${opName}ResponseBody`, 0, "out");
|
|
1353
|
-
if (conv.target !== PRELUDE.Document || deref(ctx, respSchema)) {
|
|
1354
|
-
outputTarget = addShape(ctx, `${opName}Response`, {
|
|
1355
|
-
type: "structure",
|
|
1356
|
-
members: {
|
|
1357
|
-
body: {
|
|
1358
|
-
target: conv.target,
|
|
1359
|
-
traits: {
|
|
1360
|
-
[RAW_RESPONSE_TRAIT]: {},
|
|
1361
|
-
"smithy.api#required": {},
|
|
1362
|
-
...(conv.nullable ? { [NULLABLE_TRAIT]: {} } : {}),
|
|
1363
|
-
},
|
|
1364
|
-
},
|
|
1365
|
-
},
|
|
1366
|
-
traits: { "smithy.api#output": {} },
|
|
1367
|
-
});
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
// ---- Response headers (opt-in) ----
|
|
1372
|
-
let pendingHeaders;
|
|
1373
|
-
if (allowedResponseHeaders.size > 0 && method !== "head") {
|
|
1374
|
-
const headers = successHeaders(ctx, op.responses, allowedResponseHeaders);
|
|
1375
|
-
const current = outputTarget === PRELUDE.Unit ? undefined : ctx.shapes[outputTarget];
|
|
1376
|
-
// A raw-root wrapper collapses to its payload, so it has nowhere to
|
|
1377
|
-
// carry headers.
|
|
1378
|
-
const rawRoot = Object.values(current?.members ?? {}).some((m) => m?.traits?.[RAW_RESPONSE_TRAIT] !== undefined);
|
|
1379
|
-
if (headers.length > 0 &&
|
|
1380
|
-
(current === undefined || current.type === "structure") &&
|
|
1381
|
-
!rawRoot) {
|
|
1382
|
-
const taken = new Set(Object.keys(current?.members ?? {}));
|
|
1383
|
-
const members = {};
|
|
1384
|
-
for (const header of headers) {
|
|
1385
|
-
let name = headerMemberName(header.name);
|
|
1386
|
-
if (taken.has(name))
|
|
1387
|
-
name = `${name}Header`;
|
|
1388
|
-
if (taken.has(name))
|
|
1389
|
-
continue;
|
|
1390
|
-
taken.add(name);
|
|
1391
|
-
members[name] = {
|
|
1392
|
-
target: convertSchema(ctx, header.schema, `${opName}Response${pascal(header.name)}`, 0, "out").target,
|
|
1393
|
-
traits: {
|
|
1394
|
-
"smithy.api#httpHeader": header.name,
|
|
1395
|
-
...(header.description ? { "smithy.api#documentation": header.description } : {}),
|
|
1396
|
-
},
|
|
1397
|
-
};
|
|
1398
|
-
}
|
|
1399
|
-
if (current === undefined) {
|
|
1400
|
-
outputTarget = addShape(ctx, `${opName}Response`, {
|
|
1401
|
-
type: "structure",
|
|
1402
|
-
members,
|
|
1403
|
-
traits: { "smithy.api#output": {} },
|
|
1404
|
-
});
|
|
1405
|
-
}
|
|
1406
|
-
else if (current.traits?.["smithy.api#output"] !== undefined) {
|
|
1407
|
-
current.members = { ...current.members, ...members };
|
|
1408
|
-
}
|
|
1409
|
-
else {
|
|
1410
|
-
// A named component: whether it can take the headers itself
|
|
1411
|
-
// depends on what else uses it, known once every op is converted.
|
|
1412
|
-
pendingHeaders = members;
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
}
|
|
1416
|
-
// ---- Errors ----
|
|
1417
|
-
const errors = [];
|
|
1418
|
-
for (const status of Object.keys(op.responses ?? {})) {
|
|
1419
|
-
if (!/^[45]\d\d$/.test(status))
|
|
1420
|
-
continue;
|
|
1421
|
-
if (defaultErrorStatuses.has(status))
|
|
1422
|
-
continue;
|
|
1423
|
-
const cls = statusToErrorClass[status];
|
|
1424
|
-
if (!cls)
|
|
1425
|
-
continue;
|
|
1426
|
-
const id = errorIds.get(cls);
|
|
1427
|
-
if (!usedErrors.has(cls))
|
|
1428
|
-
usedErrors.set(cls, Number(status));
|
|
1429
|
-
if (!errors.some((e) => e.target === id))
|
|
1430
|
-
errors.push({ target: id });
|
|
1431
|
-
}
|
|
1432
|
-
// ---- Pagination ----
|
|
1433
|
-
const pagination = detectPagination(ctx, params, respSchema);
|
|
1434
|
-
// ---- Operation shape ----
|
|
1435
|
-
const httpTrait = {
|
|
1436
|
-
method: method.toUpperCase(),
|
|
1437
|
-
uri,
|
|
1438
|
-
code: 200,
|
|
1439
|
-
};
|
|
1440
|
-
if (contentType === "multipart")
|
|
1441
|
-
httpTrait.contentType = "multipart";
|
|
1442
|
-
const traits = { "smithy.api#http": httpTrait };
|
|
1443
|
-
const documentation = opDoc(op);
|
|
1444
|
-
if (documentation)
|
|
1445
|
-
traits["smithy.api#documentation"] = documentation;
|
|
1446
|
-
if (pagination)
|
|
1447
|
-
traits["smithy.api#paginated"] = pagination;
|
|
1448
|
-
if (contentType)
|
|
1449
|
-
traits[CONTENT_TYPE_TRAIT] = contentType;
|
|
1450
|
-
if (options.apiVersion !== undefined) {
|
|
1451
|
-
traits[API_VERSION_TRAIT] = options.apiVersion;
|
|
1452
|
-
}
|
|
1453
|
-
const opId = addShape(ctx, opName, {
|
|
1454
|
-
type: "operation",
|
|
1455
|
-
input: { target: inputTarget },
|
|
1456
|
-
output: { target: outputTarget },
|
|
1457
|
-
...(errors.length ? { errors } : {}),
|
|
1458
|
-
traits,
|
|
1459
|
-
});
|
|
1460
|
-
serviceOps.push({ target: opId });
|
|
1461
|
-
if (pendingHeaders !== undefined) {
|
|
1462
|
-
componentHeaders.push({ opId, opName, members: pendingHeaders });
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
// ---- Response headers on named components ----
|
|
1467
|
-
// A component returned only by ops that declare headers takes them itself
|
|
1468
|
-
// (all optional) and keeps its name. A component that other shapes, or ops
|
|
1469
|
-
// without those headers, also use is copied into an op-specific output, so
|
|
1470
|
-
// the headers never leak into them.
|
|
1471
|
-
if (componentHeaders.length > 0) {
|
|
1472
|
-
const uses = targetCounts(ctx.shapes);
|
|
1473
|
-
const outputs = new Map();
|
|
1474
|
-
for (const { opId } of componentHeaders) {
|
|
1475
|
-
const id = ctx.shapes[opId].output.target;
|
|
1476
|
-
outputs.set(id, (outputs.get(id) ?? 0) + 1);
|
|
1477
|
-
}
|
|
1478
|
-
for (const { opId, opName, members } of componentHeaders) {
|
|
1479
|
-
const opShape = ctx.shapes[opId];
|
|
1480
|
-
const componentId = opShape.output.target;
|
|
1481
|
-
const component = ctx.shapes[componentId];
|
|
1482
|
-
if (uses.get(componentId) === outputs.get(componentId)) {
|
|
1483
|
-
component.members = { ...component.members, ...members };
|
|
1484
|
-
}
|
|
1485
|
-
else {
|
|
1486
|
-
opShape.output.target = addShape(ctx, `${opName}Response`, {
|
|
1487
|
-
type: "structure",
|
|
1488
|
-
members: { ...component.members, ...members },
|
|
1489
|
-
traits: {
|
|
1490
|
-
...(component.traits?.["smithy.api#documentation"]
|
|
1491
|
-
? {
|
|
1492
|
-
"smithy.api#documentation": component.traits["smithy.api#documentation"],
|
|
1493
|
-
}
|
|
1494
|
-
: {}),
|
|
1495
|
-
"smithy.api#output": {},
|
|
1496
|
-
},
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
}
|
|
1501
|
-
// ---- Error shapes (one per used class) ----
|
|
1502
|
-
for (const [cls, status] of usedErrors) {
|
|
1503
|
-
const id = errorIds.get(cls);
|
|
1504
|
-
const base = {
|
|
1505
|
-
type: "structure",
|
|
1506
|
-
members: {},
|
|
1507
|
-
traits: {
|
|
1508
|
-
"smithy.api#error": status < 500 ? "client" : "server",
|
|
1509
|
-
"smithy.api#httpError": status,
|
|
1510
|
-
[ERROR_MATCHERS_TRAIT]: [{ status }],
|
|
1511
|
-
},
|
|
1512
|
-
};
|
|
1513
|
-
const override = options.errorShapes?.[cls];
|
|
1514
|
-
ctx.shapes[id] = override
|
|
1515
|
-
? {
|
|
1516
|
-
...base,
|
|
1517
|
-
...override,
|
|
1518
|
-
traits: { ...base.traits, ...override.traits },
|
|
1519
|
-
}
|
|
1520
|
-
: base;
|
|
1521
|
-
}
|
|
1522
|
-
// ---- Service shape ----
|
|
1523
|
-
ctx.shapes[`${ctx.ns}#${serviceName}`] = {
|
|
1524
|
-
type: "service",
|
|
1525
|
-
version: options.serviceVersion ?? (typeof doc.info?.version === "string" ? doc.info.version : "1.0"),
|
|
1526
|
-
operations: serviceOps,
|
|
1527
|
-
traits: {
|
|
1528
|
-
"smithy.api#title": typeof doc.info?.title === "string" ? doc.info.title : options.serviceName,
|
|
1529
|
-
...(typeof doc.info?.description === "string"
|
|
1530
|
-
? {
|
|
1531
|
-
"smithy.api#documentation": trimDescription(doc.info.description),
|
|
1532
|
-
}
|
|
1533
|
-
: {}),
|
|
1534
|
-
},
|
|
1535
|
-
};
|
|
1536
|
-
return {
|
|
1537
|
-
smithy: "2.0",
|
|
1538
|
-
metadata: {
|
|
1539
|
-
suppressions: [
|
|
1540
|
-
{ id: "HttpUriConflict", namespace: "*" },
|
|
1541
|
-
{ id: "HttpMethodSemantics", namespace: "*" },
|
|
1542
|
-
{ id: "UnreferencedShape", namespace: "*" },
|
|
1543
|
-
],
|
|
1544
|
-
},
|
|
1545
|
-
shapes: ctx.shapes,
|
|
1546
|
-
};
|
|
1547
|
-
};
|
|
1548
|
-
//# sourceMappingURL=openapi.js.map
|