@aws/nx-plugin 1.0.0 → 1.0.1
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/LICENSE-THIRD-PARTY +11686 -23398
- package/README.md +18 -0
- package/generators.json +7 -0
- package/migrations.json +34 -1
- package/package.json +6 -6
- package/src/agentcore-gateway/schema.json +1 -0
- package/src/agentcore-harness/generator.d.ts +1 -1
- package/src/connection/scaffold-catalog.d.ts +4 -0
- package/src/connection/scaffold-catalog.js +3 -6
- package/src/connection/scaffold-catalog.js.map +1 -1
- package/src/infra/app/generator.d.ts +1 -1
- package/src/init/generator.d.ts +1 -1
- package/src/mcp-server/guide-pipeline.d.ts +2 -1
- package/src/mcp-server/guide-pipeline.js +6 -0
- package/src/mcp-server/guide-pipeline.js.map +1 -1
- package/src/mcp-server/mdx-ast.d.ts +7 -0
- package/src/mcp-server/mdx-ast.js +15 -0
- package/src/mcp-server/mdx-ast.js.map +1 -1
- package/src/mcp-server/schema-registry.d.ts +2 -2
- package/src/mcp-server/schema-registry.js +2 -2
- package/src/mcp-server/schema-registry.js.map +1 -1
- package/src/open-api/py-client/__snapshots__/generator.additional-properties.spec.ts.snap +34 -0
- package/src/open-api/py-client/__snapshots__/generator.arrays.spec.ts.snap +1750 -0
- package/src/open-api/py-client/__snapshots__/generator.complex-types.spec.ts.snap +82 -0
- package/src/open-api/py-client/__snapshots__/generator.composite-types.spec.ts.snap +447 -0
- package/src/open-api/py-client/__snapshots__/generator.duplicate-types.spec.ts.snap +404 -0
- package/src/open-api/py-client/__snapshots__/generator.errors.spec.ts.snap +430 -0
- package/src/open-api/py-client/__snapshots__/generator.fast-api.spec.ts.snap +447 -0
- package/src/open-api/py-client/__snapshots__/generator.petstore.spec.ts.snap +3488 -0
- package/src/open-api/py-client/__snapshots__/generator.primitive-types.spec.ts.snap +1444 -0
- package/src/open-api/py-client/__snapshots__/generator.request.spec.ts.snap +390 -0
- package/src/open-api/py-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +364 -0
- package/src/open-api/py-client/__snapshots__/generator.response.spec.ts.snap +739 -0
- package/src/open-api/py-client/__snapshots__/generator.streaming.spec.ts.snap +384 -0
- package/src/open-api/py-client/__snapshots__/generator.tags.spec.ts.snap +414 -0
- package/src/open-api/py-client/files/client/__clientModuleName__.py.template +1076 -0
- package/src/open-api/py-client/files/shared/__init__.py.template +28 -0
- package/src/open-api/py-client/files/shared/errors.py.template +37 -0
- package/src/open-api/py-client/files/shared/types.py.template +319 -0
- package/src/open-api/py-client/generator.d.ts +53 -0
- package/src/open-api/py-client/generator.js +119 -0
- package/src/open-api/py-client/generator.js.map +1 -0
- package/src/open-api/py-client/schema.d.js +6 -0
- package/src/open-api/py-client/schema.d.js.map +1 -0
- package/src/open-api/py-client/schema.d.ts +12 -0
- package/src/open-api/py-client/schema.json +28 -0
- package/src/open-api/py-client/vessel-registry-spec.json +2716 -0
- package/src/open-api/ts-client/__snapshots__/generator.edge-cases.spec.ts.snap +274 -0
- package/src/open-api/ts-client/petstore-spec.d.ts +6 -0
- package/src/open-api/ts-client/petstore-spec.js +1275 -0
- package/src/open-api/ts-client/petstore-spec.js.map +1 -0
- package/src/open-api/ts-hooks/generator.spec.tsx +1 -1
- package/src/open-api/utils/codegen-data/languages.d.ts +68 -2
- package/src/open-api/utils/codegen-data/languages.js +433 -21
- package/src/open-api/utils/codegen-data/languages.js.map +1 -1
- package/src/open-api/utils/codegen-data/types.d.ts +187 -0
- package/src/open-api/utils/codegen-data/types.js +10 -1
- package/src/open-api/utils/codegen-data/types.js.map +1 -1
- package/src/open-api/utils/codegen-data.d.ts +40 -1
- package/src/open-api/utils/codegen-data.js +622 -17
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.js +175 -41
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/open-api/utils/parser.js +1 -1
- package/src/open-api/utils/parser.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/preset/generator.d.ts +1 -1
- package/src/py/agent/gateway-connection/generator.js +0 -3
- package/src/py/agent/gateway-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/generator.d.ts +1 -1
- package/src/py/agent/schema.json +2 -0
- package/src/py/fast-api/react/generator.d.ts +1 -1
- package/src/py/mcp-server/schema.json +1 -0
- package/src/sdk/open-api.d.ts +2 -0
- package/src/sdk/open-api.js +1 -0
- package/src/sdk/open-api.js.map +1 -1
- package/src/smithy/project/generator.d.ts +1 -1
- package/src/smithy/react-connection/generator.d.ts +1 -1
- package/src/terraform/project/generator.d.ts +1 -1
- package/src/trpc/react/generator.d.ts +1 -1
- package/src/ts/agent/a2a-connection/generator.d.ts +1 -1
- package/src/ts/agent/gateway-connection/generator.d.ts +1 -1
- package/src/ts/agent/gateway-connection/generator.js +0 -3
- package/src/ts/agent/gateway-connection/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/generator.d.ts +1 -1
- package/src/ts/agent/react-connection/generator.d.ts +1 -1
- package/src/ts/agent/schema.json +1 -0
- package/src/ts/api/schema.json +2 -0
- package/src/ts/astro-docs/generator.d.ts +1 -1
- package/src/ts/dcr-proxy/generator.d.ts +1 -1
- package/src/ts/dynamodb/generator.d.ts +1 -1
- package/src/ts/lambda-function/generator.d.ts +1 -1
- package/src/ts/lib/generator.d.ts +1 -1
- package/src/ts/mcp-server/schema.json +1 -0
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.spec.ts.template +1 -1
- package/src/ts/nx-generator/generator.d.ts +1 -1
- package/src/ts/nx-migration/generator.d.ts +1 -1
- package/src/ts/nx-plugin/generator.d.ts +1 -1
- package/src/ts/rdb/generator.d.ts +1 -1
- package/src/ts/react-website/agui/generator.d.ts +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +10 -10
- package/src/ts/react-website/app/schema.json +1 -0
- package/src/ts/website/app/schema.json +1 -0
- package/src/utils/metrics-assertions.d.ts +18 -0
- package/src/utils/metrics-assertions.js +42 -0
- package/src/utils/metrics-assertions.js.map +1 -0
- package/src/utils/test/python-dependencies.d.ts +8 -0
- package/src/utils/test/python-dependencies.js +14 -0
- package/src/utils/test/python-dependencies.js.map +1 -0
- package/src/utils/test/python-worker/worker.py +703 -0
- package/src/utils/test/warm-python-cache.d.ts +18 -0
- package/src/utils/test/warm-python-cache.js +46 -0
- package/src/utils/test/warm-python-cache.js.map +1 -0
- package/src/utils/versions.d.ts +10 -9
- package/src/utils/versions.js +9 -8
- package/src/utils/versions.js.map +1 -1
|
@@ -40,20 +40,38 @@ import { isRef, resolveIfRef, resolveRef, splitRef } from "./refs.js";
|
|
|
40
40
|
if (Object.keys(schemaNameMapping).length === 0) {
|
|
41
41
|
return spec;
|
|
42
42
|
}
|
|
43
|
+
/** The renamed form of a schema reference, or undefined if it is unaffected. */ const renamedRef = (ref)=>{
|
|
44
|
+
const parts = splitRef(ref);
|
|
45
|
+
if (parts.length !== 3 || parts[0] !== 'components' || parts[1] !== 'schemas') {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const newName = schemaNameMapping[parts[2]];
|
|
49
|
+
return newName ? `#/components/schemas/${newName}` : undefined;
|
|
50
|
+
};
|
|
43
51
|
// Update all $ref references throughout the spec
|
|
44
52
|
spec = cloneDeepWith(spec, (v)=>{
|
|
45
53
|
if (isRef(v)) {
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
$ref: `#/components/schemas/${newName}`
|
|
53
|
-
};
|
|
54
|
-
}
|
|
54
|
+
const renamed = renamedRef(v.$ref);
|
|
55
|
+
if (renamed) {
|
|
56
|
+
return {
|
|
57
|
+
$ref: renamed
|
|
58
|
+
};
|
|
55
59
|
}
|
|
56
60
|
}
|
|
61
|
+
// A `discriminator.mapping` value is a bare reference string, not a `$ref`
|
|
62
|
+
// object, so it is rewritten here. Left stale it no longer resolves, and a
|
|
63
|
+
// tagged union silently degrades to an untagged one — which can parse a
|
|
64
|
+
// response into the wrong branch rather than failing.
|
|
65
|
+
if (v && typeof v === 'object' && !Array.isArray(v) && typeof v.propertyName === 'string' && v.mapping && typeof v.mapping === 'object') {
|
|
66
|
+
const discriminator = v;
|
|
67
|
+
return {
|
|
68
|
+
...discriminator,
|
|
69
|
+
mapping: Object.fromEntries(Object.entries(discriminator.mapping).map(([value, ref])=>[
|
|
70
|
+
value,
|
|
71
|
+
typeof ref === 'string' ? renamedRef(ref) ?? ref : ref
|
|
72
|
+
]))
|
|
73
|
+
};
|
|
74
|
+
}
|
|
57
75
|
});
|
|
58
76
|
// Rename schema keys, recording the original name so downstream code can
|
|
59
77
|
// recover the on-the-wire value (e.g. an implicit discriminator matches on
|
|
@@ -73,7 +91,14 @@ const isCompositeSchema = (schema)=>!!schema.allOf || !!schema.anyOf || !!schema
|
|
|
73
91
|
* The media type whose schema is hoisted for a request/response: prefer
|
|
74
92
|
* `application/json`, falling back to any `+json` vendored type (e.g.
|
|
75
93
|
* `application/problem+json`).
|
|
76
|
-
|
|
94
|
+
*
|
|
95
|
+
* Parameters are stripped before matching, as they are for the `+json` fallback:
|
|
96
|
+
* a media type's parameters do not identify it (RFC 9110 §8.3), and matching
|
|
97
|
+
* `application/json` exactly meant `application/json; charset=utf-8` — a common
|
|
98
|
+
* spelling — hoisted nothing, so the response type resolved to a name that was
|
|
99
|
+
* never declared.
|
|
100
|
+
*/ const baseMediaType = (mediaType)=>mediaType.split(';')[0].trim();
|
|
101
|
+
const preferredJsonMediaType = (mediaTypes)=>mediaTypes.find((mediaType)=>baseMediaType(mediaType) === 'application/json') ?? mediaTypes.find((mediaType)=>baseMediaType(mediaType).endsWith('+json'));
|
|
77
102
|
const FORM_MEDIA_TYPES = [
|
|
78
103
|
'multipart/form-data',
|
|
79
104
|
'application/x-www-form-urlencoded'
|
|
@@ -84,21 +109,38 @@ const isFormMediaType = (mediaType)=>FORM_MEDIA_TYPES.includes(mediaType.split('
|
|
|
84
109
|
* content — an octet-stream, image, audio, etc.
|
|
85
110
|
*/ const isBinaryContentMediaType = (contentMediaType)=>!(contentMediaType.startsWith('text/') || contentMediaType === 'application/json' || contentMediaType.endsWith('+json') || contentMediaType === 'application/xml');
|
|
86
111
|
/**
|
|
87
|
-
* Rewrite
|
|
88
|
-
* generator types
|
|
112
|
+
* Rewrite a binary string schema, and any nested within it, to `format: binary`
|
|
113
|
+
* so the generator types it as a file rather than text.
|
|
114
|
+
*
|
|
115
|
+
* A base64 `contentEncoding` or a textual/JSON `contentMediaType` keeps the
|
|
116
|
+
* schema a string, and `format: binary` is left untouched (already binary
|
|
117
|
+
* anywhere). Nesting is walked because a file is not always a bare property:
|
|
118
|
+
* `list[UploadFile]` puts it under `items` and `UploadFile | None` under
|
|
119
|
+
* `anyOf`, and an element left unmarked stayed a `str`, so it was sent as a text
|
|
120
|
+
* part the server rejected.
|
|
121
|
+
*
|
|
122
|
+
* Callers decide *where* this applies, since FastAPI emits the same schema
|
|
89
123
|
* (`{type: string, contentMediaType: ...}`) for a multipart file field and for
|
|
90
|
-
* `bytes` in a JSON body
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
124
|
+
* `bytes` in a JSON body — only the enclosing media type tells them apart.
|
|
125
|
+
*/ const markBinaryStringSchema = (schema)=>{
|
|
126
|
+
if (!schema || typeof schema !== 'object' || isRef(schema)) return;
|
|
127
|
+
const s = schema;
|
|
128
|
+
if (s.type === 'string' && s.format !== 'binary' && s.contentMediaType && !s.contentEncoding && isBinaryContentMediaType(s.contentMediaType)) {
|
|
129
|
+
s.format = 'binary';
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
markBinaryStringSchema(s.items);
|
|
133
|
+
for (const member of [
|
|
134
|
+
...s.anyOf ?? [],
|
|
135
|
+
...s.oneOf ?? [],
|
|
136
|
+
...s.allOf ?? [],
|
|
137
|
+
...s.prefixItems ?? []
|
|
138
|
+
]){
|
|
139
|
+
markBinaryStringSchema(member);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
/** A form body's binary string fields are file uploads. */ const markFormBinaryFields = (schema)=>{
|
|
143
|
+
Object.values(schema.properties ?? {}).forEach(markBinaryStringSchema);
|
|
102
144
|
};
|
|
103
145
|
const hasSubSchemasToVisit = (schema)=>!!schema && !isRef(schema) && ([
|
|
104
146
|
'object',
|
|
@@ -142,15 +184,20 @@ const filterInlineCompositeSchemas = (schemas, nameParts, namePartPrefix, propPa
|
|
|
142
184
|
// later derive — otherwise a part like `store_photos` yields a `Store_photos`
|
|
143
185
|
// schema whose reference (`StorePhotos`) no longer resolves.
|
|
144
186
|
const candidateName = nameParts.map(toClassName).join('');
|
|
145
|
-
const seenModelNameCount = seenModelNameCounts[candidateName];
|
|
146
187
|
// We have not seen this name so we're free to use it
|
|
147
|
-
if (
|
|
188
|
+
if (seenModelNameCounts[candidateName] === undefined) {
|
|
148
189
|
seenModelNameCounts[candidateName] = 1;
|
|
149
190
|
return candidateName;
|
|
150
191
|
}
|
|
151
|
-
// We have seen the name before, so we must disambiguate
|
|
152
|
-
|
|
153
|
-
|
|
192
|
+
// We have seen the name before, so we must disambiguate. The suffixed name
|
|
193
|
+
// needs checking too: a declared schema may already be called `FooBar1`, and
|
|
194
|
+
// taking it silently replaced the user's schema with the hoisted one.
|
|
195
|
+
let suffixed = `${candidateName}${seenModelNameCounts[candidateName]++}`;
|
|
196
|
+
while(seenModelNameCounts[suffixed] !== undefined){
|
|
197
|
+
suffixed = `${candidateName}${seenModelNameCounts[candidateName]++}`;
|
|
198
|
+
}
|
|
199
|
+
seenModelNameCounts[suffixed] = 1;
|
|
200
|
+
return suffixed;
|
|
154
201
|
};
|
|
155
202
|
const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
|
|
156
203
|
// Find all the inline subschemas we should visit
|
|
@@ -339,6 +386,47 @@ const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
|
|
|
339
386
|
};
|
|
340
387
|
return cloneDeepWith(spec, rewrite);
|
|
341
388
|
};
|
|
389
|
+
/**
|
|
390
|
+
* Upper-cases wildcard response status codes (`2xx` to `2XX`), drops spec
|
|
391
|
+
* extensions, and rejects a key that is neither.
|
|
392
|
+
*
|
|
393
|
+
* OpenAPI treats the range codes case-insensitively, but every consumer
|
|
394
|
+
* downstream matches the upper-case form — a lower-case key would otherwise be
|
|
395
|
+
* taken for a literal status code and emitted as one, which is not valid Python
|
|
396
|
+
* or TypeScript. A key that is no kind of status code was emitted as a bare name
|
|
397
|
+
* either way: `x-vendor-note` did not parse, and an alphabetic one like `unknown`
|
|
398
|
+
* parsed and imported, then raised `NameError` from `response.status_code ==
|
|
399
|
+
* unknown` only once that status arrived.
|
|
400
|
+
*/ const RESPONSE_CODE_PATTERN = /^(?:\d{3}|\d[xX]{2}|default)$/;
|
|
401
|
+
const normaliseResponseCodeCase = (spec)=>{
|
|
402
|
+
for (const [path, pathItem] of Object.entries(spec.paths ?? {})){
|
|
403
|
+
for (const [method, operation] of Object.entries(pathItem ?? {})){
|
|
404
|
+
const responses = operation?.responses;
|
|
405
|
+
if (!responses || typeof responses !== 'object') continue;
|
|
406
|
+
for (const code of Object.keys(responses)){
|
|
407
|
+
// A `x-` extension is legal on the Responses Object and describes nothing
|
|
408
|
+
// to generate, so it is dropped rather than rejected.
|
|
409
|
+
if (code.startsWith('x-')) {
|
|
410
|
+
delete responses[code];
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
if (!RESPONSE_CODE_PATTERN.test(code)) {
|
|
414
|
+
throw new Error(`Operation "${method.toUpperCase()} ${path}" declares a response keyed "${code}", which is not a status code, a wildcard range (such as "5XX") or "default". Please correct it in your OpenAPI specification.`);
|
|
415
|
+
}
|
|
416
|
+
if (!/^\d[xX]{2}$/.test(code) || code === code.toUpperCase()) continue;
|
|
417
|
+
const upper = code.toUpperCase();
|
|
418
|
+
// Both spellings name the same range, so one would silently overwrite
|
|
419
|
+
// the other — and which survived would depend on key order. The repo
|
|
420
|
+
// throws on a schema-name collision for the same reason.
|
|
421
|
+
if (upper in responses) {
|
|
422
|
+
throw new Error(`Response code conflict: "${code}" and "${upper}" describe the same status range. Please declare only one of them in your OpenAPI specification.`);
|
|
423
|
+
}
|
|
424
|
+
responses[upper] = responses[code];
|
|
425
|
+
delete responses[code];
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
};
|
|
342
430
|
/**
|
|
343
431
|
* Rewrites an OpenAPI 3.1 multi-type schema (`type: ['integer', 'string']`)
|
|
344
432
|
* into the equivalent `anyOf` of single-type schemas, dropping `null` from the
|
|
@@ -401,6 +489,7 @@ const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
|
|
|
401
489
|
// Clone the spec so we're free to mutate it
|
|
402
490
|
let spec = cloneDeepWith(inSpec);
|
|
403
491
|
inlinePathItemRefs(spec);
|
|
492
|
+
normaliseResponseCodeCase(spec);
|
|
404
493
|
spec = rewriteConstToEnum(spec);
|
|
405
494
|
spec = rewriteMultiTypeToAnyOf(spec);
|
|
406
495
|
spec = rewriteCompositeSiblingProperties(spec);
|
|
@@ -415,11 +504,17 @@ const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
|
|
|
415
504
|
}
|
|
416
505
|
const seenOperationIds = new Set();
|
|
417
506
|
const duplicatedOperationIds = new Set();
|
|
507
|
+
// camelCasing is lossy — ids differing only in punctuation converge, and one
|
|
508
|
+
// written entirely in punctuation converges on the empty string. Keep what the
|
|
509
|
+
// document said so a rejection can name the operations the author has to change.
|
|
510
|
+
const writtenOperationIds = new Map();
|
|
418
511
|
// Make sure all operationIds are camelCase, and find which ones are duplicated
|
|
419
512
|
Object.entries(spec.paths ?? {}).forEach(([path, pathOps])=>Object.entries(pathOps ?? {}).forEach(([method, op])=>{
|
|
420
513
|
const operation = resolveIfRef(spec, op);
|
|
421
514
|
if (operation && typeof operation === 'object') {
|
|
422
|
-
const
|
|
515
|
+
const written = operation.operationId ?? `${method}-${path}`;
|
|
516
|
+
const operationId = camelCase(written);
|
|
517
|
+
writtenOperationIds.set(operation, String(written));
|
|
423
518
|
operation.operationId = operationId;
|
|
424
519
|
if (seenOperationIds.has(operationId)) {
|
|
425
520
|
duplicatedOperationIds.add(operationId);
|
|
@@ -448,14 +543,25 @@ const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
|
|
|
448
543
|
operation['x-aws-nx-deduplicated-op-id'] = deduplicatedOpId;
|
|
449
544
|
operation['x-aws-nx-deduplicated-dot-op-id'] = deduplicatedDotNotationOpId;
|
|
450
545
|
seenOperationIds.add(deduplicatedOpId);
|
|
451
|
-
// Throw an error for any duplicated operation ids with the same tag, or
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
546
|
+
// Throw an error for any duplicated operation ids with the same tag, or
|
|
547
|
+
// untagged. Keyed on the *normalised* tag: two tags that differ only in
|
|
548
|
+
// punctuation (`my-tag` and `my.tag`) become one namespace downstream, so
|
|
549
|
+
// ids that clash there clash for the client — and deduplicating by tag
|
|
550
|
+
// cannot separate them, which silently dropped an operation.
|
|
551
|
+
const normalisedTags = tags.length === 0 ? [
|
|
552
|
+
untagged
|
|
553
|
+
] : [
|
|
554
|
+
...new Set(tags.map((t)=>camelCase(t)))
|
|
555
|
+
];
|
|
556
|
+
normalisedTags.forEach((tag)=>{
|
|
457
557
|
if (seenOperationIdsByTag[tag] && seenOperationIdsByTag[tag].has(operationId)) {
|
|
458
|
-
|
|
558
|
+
// Report tag and id as written: either normalises to the empty
|
|
559
|
+
// string when spelt with no alphanumerics, which names nothing to
|
|
560
|
+
// the reader. `path` and `method` pin down which operation to edit.
|
|
561
|
+
const tagsAsWritten = tags.map((t)=>`"${t}"`).join(', ');
|
|
562
|
+
const idAsWritten = `"${writtenOperationIds.get(operation) ?? operationId}"`;
|
|
563
|
+
const at = `${method.toUpperCase()} ${path}`;
|
|
564
|
+
throw new Error(tag === untagged ? `Untagged operations cannot have the same operationId (${idAsWritten}, at ${at})` : `Operations with the same tag (${tagsAsWritten}) cannot have the same operationId (${idAsWritten}, at ${at})`);
|
|
459
565
|
}
|
|
460
566
|
seenOperationIdsByTag[tag] = new Set([
|
|
461
567
|
...seenOperationIdsByTag[tag] ?? [],
|
|
@@ -509,6 +615,18 @@ const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
|
|
|
509
615
|
const resolved = resolveIfRef(spec, bodyContentSchema);
|
|
510
616
|
if (resolved) markFormBinaryFields(resolved);
|
|
511
617
|
}
|
|
618
|
+
// A whole body under a binary media type is itself the file. FastAPI
|
|
619
|
+
// writes `bytes` as `{type: string, contentMediaType: ...}`, which
|
|
620
|
+
// without this stayed a `str` and was sent as `repr(bytes)`.
|
|
621
|
+
for (const mediaType of contentMediaTypes){
|
|
622
|
+
if (isFormMediaType(mediaType) || !isBinaryContentMediaType(mediaType)) {
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
const schema = requestBody.content[mediaType]?.schema;
|
|
626
|
+
if (schema && !isRef(schema) && schema.type === 'string') {
|
|
627
|
+
schema.format = 'binary';
|
|
628
|
+
}
|
|
629
|
+
}
|
|
512
630
|
if (bodyContentSchema && !isRef(bodyContentSchema) && ([
|
|
513
631
|
'object',
|
|
514
632
|
'array'
|
|
@@ -527,12 +645,27 @@ const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
|
|
|
527
645
|
(operation.parameters ?? []).forEach((p)=>{
|
|
528
646
|
const param = resolveIfRef(spec, p);
|
|
529
647
|
const paramSchema = param?.schema;
|
|
530
|
-
if (paramSchema
|
|
531
|
-
|
|
648
|
+
if (!paramSchema || isRef(paramSchema)) return;
|
|
649
|
+
const schemaName = `${upperFirst(deduplicatedOpId)}Request${upperFirst(param.in)}${upperFirst(camelCase(param.name))}`;
|
|
650
|
+
const needsName = (schema)=>isCompositeSchema(schema) || schema.type === 'object' && !!schema.properties;
|
|
651
|
+
if (needsName(paramSchema)) {
|
|
532
652
|
spec.components.schemas[schemaName] = paramSchema;
|
|
533
653
|
param.schema = {
|
|
534
654
|
$ref: `#/components/schemas/${schemaName}`
|
|
535
655
|
};
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
// An array's items need a name of their own: left inline, a composite
|
|
659
|
+
// there rendered as a member type nothing declared — `list[U]`, since
|
|
660
|
+
// the anonymous schema's name escapes to nothing.
|
|
661
|
+
// `items` is declared only on the array branch of `SchemaObject`.
|
|
662
|
+
const items = paramSchema.items;
|
|
663
|
+
if (paramSchema.type === 'array' && items && !isRef(items) && needsName(items)) {
|
|
664
|
+
const itemName = `${schemaName}Item`;
|
|
665
|
+
spec.components.schemas[itemName] = items;
|
|
666
|
+
paramSchema.items = {
|
|
667
|
+
$ref: `#/components/schemas/${itemName}`
|
|
668
|
+
};
|
|
536
669
|
}
|
|
537
670
|
});
|
|
538
671
|
}
|
|
@@ -563,8 +696,9 @@ const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
|
|
|
563
696
|
// The substituted body is itself walked for refs, so a chain — an array whose
|
|
564
697
|
// items are a named scalar — collapses in one pass. Substituting the array
|
|
565
698
|
// without following through left `items` pointing at a schema this same pass
|
|
566
|
-
// deletes, so the client referred to a type nothing declared
|
|
567
|
-
// TypeScript did not compile
|
|
699
|
+
// deletes, so the client referred to a type nothing declared — the emitted
|
|
700
|
+
// TypeScript did not compile, and the Python raised `AttributeError` on every
|
|
701
|
+
// call, which neither parsing nor importing the package reveals.
|
|
568
702
|
const inlinedRefs = new Set();
|
|
569
703
|
const inlineNonObjectRefs = (value)=>cloneDeepWith(value, (v)=>{
|
|
570
704
|
if (v && typeof v === 'object' && v.$ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/open-api/utils/normalise.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport cloneDeepWith from 'lodash.clonedeepwith';\nimport type { OpenAPIV3 } from 'openapi-types';\nimport {\n camelCase,\n pascalCase,\n toClassName,\n upperFirst,\n} from '../../utils/names.js';\nimport { STREAMING_CONTENT_TYPES } from './codegen-data/types.js';\nimport { isRef, resolveIfRef, resolveRef, splitRef } from './refs.js';\nimport type { Spec } from './types.js';\n\ninterface SubSchema {\n readonly nameParts: string[];\n readonly schema: OpenAPIV3.SchemaObject;\n readonly propPath: (string | number)[];\n}\n\ninterface SubSchemaRef {\n readonly $ref: string;\n readonly name: string;\n readonly schema: OpenAPIV3.SchemaObject;\n}\n\n/**\n * Normalise schema names to valid TypeScript identifiers.\n * Converts names with hyphens or other invalid characters to PascalCase.\n * Throws an error if normalisation would create a name clash.\n */\nconst normaliseSchemaNames = (spec: Spec): Spec => {\n const schemaNameMapping: { [oldName: string]: string } = {};\n const originalNames = Object.keys(spec.components?.schemas ?? {});\n const existingSchemaNames = new Set(originalNames);\n\n // The name each schema resolves to (its normalised form, or itself when it\n // needs no normalisation). Used to detect two distinct schemas that would\n // collapse onto the same identifier.\n const resolvedNameOwners: { [resolvedName: string]: string } = {};\n\n // Build mapping of old names to new names\n originalNames.forEach((name) => {\n const normalizedName = toClassName(name);\n if (normalizedName !== name) {\n // Check if the normalized name would clash with an existing schema\n if (existingSchemaNames.has(normalizedName)) {\n throw new Error(\n `Schema name normalization conflict: \"${name}\" would be normalized to \"${normalizedName}\", but a schema with that name already exists. Please rename one of these schemas in your OpenAPI specification.`,\n );\n }\n schemaNameMapping[name] = normalizedName;\n }\n\n // Detect two distinct schemas resolving to the same name (e.g. \"Foo-Bar\"\n // and \"Foo.Bar\" both normalise to \"FooBar\"), which would otherwise\n // silently overwrite one another.\n const owner = resolvedNameOwners[normalizedName];\n if (owner !== undefined) {\n throw new Error(\n `Schema name normalization conflict: \"${name}\" and \"${owner}\" both normalize to \"${normalizedName}\". Please rename one of these schemas in your OpenAPI specification.`,\n );\n }\n resolvedNameOwners[normalizedName] = name;\n });\n\n // If no normalization needed, return spec as-is\n if (Object.keys(schemaNameMapping).length === 0) {\n return spec;\n }\n\n // Update all $ref references throughout the spec\n spec = cloneDeepWith(spec, (v) => {\n if (isRef(v)) {\n const parts = splitRef(v.$ref);\n if (\n parts.length === 3 &&\n parts[0] === 'components' &&\n parts[1] === 'schemas'\n ) {\n const oldName = parts[2];\n const newName = schemaNameMapping[oldName];\n if (newName) {\n return { $ref: `#/components/schemas/${newName}` };\n }\n }\n }\n });\n\n // Rename schema keys, recording the original name so downstream code can\n // recover the on-the-wire value (e.g. an implicit discriminator matches on\n // the original schema name, not its normalised identifier).\n Object.entries(schemaNameMapping).forEach(([oldName, newName]) => {\n const schema = spec.components!.schemas![oldName];\n if (schema && !isRef(schema)) {\n (schema as { 'x-aws-nx-original-name'?: string })[\n 'x-aws-nx-original-name'\n ] = oldName;\n }\n spec.components!.schemas![newName] = schema;\n delete spec.components!.schemas![oldName];\n });\n\n return spec;\n};\n\nconst isCompositeSchema = (schema: OpenAPIV3.SchemaObject) =>\n !!schema.allOf || !!schema.anyOf || !!schema.oneOf;\n\n/**\n * The media type whose schema is hoisted for a request/response: prefer\n * `application/json`, falling back to any `+json` vendored type (e.g.\n * `application/problem+json`).\n */\nconst preferredJsonMediaType = (mediaTypes: string[]): string | undefined =>\n mediaTypes.find((mediaType) => mediaType === 'application/json') ??\n mediaTypes.find((mediaType) => mediaType.split(';')[0].endsWith('+json'));\n\nconst FORM_MEDIA_TYPES = [\n 'multipart/form-data',\n 'application/x-www-form-urlencoded',\n];\n\nconst isFormMediaType = (mediaType: string): boolean =>\n FORM_MEDIA_TYPES.includes(mediaType.split(';')[0]);\n\n/**\n * Whether a `contentMediaType` denotes binary (rather than textual/JSON)\n * content — an octet-stream, image, audio, etc.\n */\nconst isBinaryContentMediaType = (contentMediaType: string): boolean =>\n !(\n contentMediaType.startsWith('text/') ||\n contentMediaType === 'application/json' ||\n contentMediaType.endsWith('+json') ||\n contentMediaType === 'application/xml'\n );\n\n/**\n * Rewrite file string fields of a form body to `format: binary` so the\n * generator types them as `Blob`. FastAPI emits an identical schema\n * (`{type: string, contentMediaType: ...}`) for a multipart file field and for\n * `bytes` in a JSON body; only the enclosing media type distinguishes them, so\n * this promotion is scoped to form bodies. A base64 `contentEncoding` or a\n * textual/JSON `contentMediaType` keeps the field a string. `format: binary` is\n * left untouched (already binary anywhere).\n */\nconst markFormBinaryFields = (schema: OpenAPIV3.SchemaObject): void => {\n Object.values(schema.properties ?? {}).forEach((prop) => {\n if (isRef(prop)) return;\n const s = prop as OpenAPIV3.SchemaObject & {\n contentMediaType?: string;\n contentEncoding?: string;\n };\n if (\n s.type === 'string' &&\n s.format !== 'binary' &&\n s.contentMediaType &&\n !s.contentEncoding &&\n isBinaryContentMediaType(s.contentMediaType)\n ) {\n s.format = 'binary';\n }\n });\n};\n\nconst hasSubSchemasToVisit = (\n schema?: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject,\n): schema is OpenAPIV3.SchemaObject =>\n !!schema &&\n !isRef(schema) &&\n (['object', 'array'].includes(schema.type as any) ||\n // `type` is optional, and `properties` implies an object — which is how the\n // parser already classifies one. Requiring the explicit `type` left such a\n // schema unhoisted, so an `allOf` member written that way stayed inline and\n // was taken for a non-object, rejecting the whole document.\n !!schema.properties ||\n // `patternProperties` is JSON Schema, so it is not on the 3.0 type.\n !!(schema as { patternProperties?: unknown }).patternProperties ||\n isCompositeSchema(schema) ||\n !!schema.not ||\n (schema.type === 'string' && !!schema.enum));\n\nconst filterInlineCompositeSchemas = (\n schemas: (OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject)[],\n nameParts: string[],\n namePartPrefix: string,\n propPath: (string | number)[],\n): SubSchema[] => {\n let inlineSchemaIndex = 0;\n return schemas.flatMap((s, i) => {\n if (hasSubSchemasToVisit(s)) {\n const subSchema: SubSchema = {\n nameParts: s.title\n ? [pascalCase(s.title)]\n : [\n ...nameParts,\n `${namePartPrefix}${inlineSchemaIndex === 0 ? '' : inlineSchemaIndex}`,\n ],\n schema: s,\n propPath: [...propPath, i],\n };\n inlineSchemaIndex++;\n return [subSchema];\n }\n return [];\n });\n};\n\n/**\n * Returns a unique model/schema name for any models which we hoist\n */\nconst createUniqueModelName = (\n nameParts: string[],\n seenModelNameCounts: { [name: string]: number },\n): string => {\n // Normalise each part to a class-name form (stripping `_`, hyphens, etc) so\n // the hoisted schema name matches what `toTypeScriptModelName`/`toClassName`\n // later derive — otherwise a part like `store_photos` yields a `Store_photos`\n // schema whose reference (`StorePhotos`) no longer resolves.\n const candidateName = nameParts.map(toClassName).join('');\n\n const seenModelNameCount = seenModelNameCounts[candidateName];\n\n // We have not seen this name so we're free to use it\n if (seenModelNameCount === undefined) {\n seenModelNameCounts[candidateName] = 1;\n return candidateName;\n }\n\n // We have seen the name before, so we must disambiguate\n seenModelNameCounts[candidateName]++;\n return `${candidateName}${seenModelNameCount}`;\n};\n\nconst hoistInlineObjectSubSchemas = (\n nameParts: string[],\n schema: OpenAPIV3.SchemaObject,\n seenModelNameCounts: { [name: string]: number },\n): SubSchemaRef[] => {\n // Find all the inline subschemas we should visit\n const inlineSubSchemas: SubSchema[] = [\n ...(hasSubSchemasToVisit(schema.not)\n ? [\n {\n nameParts: schema.not?.title\n ? [pascalCase(schema.not?.title)]\n : [...nameParts, 'Not'],\n schema: schema.not,\n propPath: ['not'],\n },\n ]\n : []),\n ...(schema.anyOf\n ? filterInlineCompositeSchemas(schema.anyOf, nameParts, 'AnyOf', [\n 'anyOf',\n ])\n : []),\n ...(schema.allOf\n ? filterInlineCompositeSchemas(schema.allOf, nameParts, 'AllOf', [\n 'allOf',\n ])\n : []),\n ...(schema.oneOf\n ? filterInlineCompositeSchemas(schema.oneOf, nameParts, 'OneOf', [\n 'oneOf',\n ])\n : []),\n ...('items' in schema && hasSubSchemasToVisit(schema.items)\n ? [\n {\n nameParts: schema.items?.title\n ? [pascalCase(schema.items?.title)]\n : [...nameParts, 'Item'],\n schema: schema.items,\n propPath: ['items'],\n },\n ]\n : []),\n ...(\n (schema as { prefixItems?: OpenAPIV3.SchemaObject[] }).prefixItems ?? []\n ).flatMap((s, i) =>\n hasSubSchemasToVisit(s)\n ? [\n {\n nameParts: s.title\n ? [pascalCase(s.title)]\n : [...nameParts, 'Item', `${i}`],\n schema: s,\n propPath: ['prefixItems', i],\n },\n ]\n : [],\n ),\n ...Object.entries(schema.properties ?? {})\n .filter(([, s]) => hasSubSchemasToVisit(s))\n .map(([name, s]) => ({\n nameParts: (s as OpenAPIV3.SchemaObject).title\n ? [pascalCase((s as OpenAPIV3.SchemaObject).title)]\n : [...nameParts, name],\n schema: s as OpenAPIV3.SchemaObject,\n propPath: ['properties', name],\n })),\n ...(typeof schema.additionalProperties !== 'boolean' &&\n hasSubSchemasToVisit(schema.additionalProperties)\n ? [\n {\n nameParts: schema.additionalProperties?.title\n ? [pascalCase(schema.additionalProperties?.title)]\n : [...nameParts, 'Value'],\n schema: schema.additionalProperties,\n propPath: ['additionalProperties'],\n },\n ]\n : []),\n ...Object.entries((schema as any).patternProperties ?? {})\n .filter(([, s]) => hasSubSchemasToVisit(s))\n .map(([pattern, s], i) => ({\n nameParts: (s as OpenAPIV3.SchemaObject).title\n ? [pascalCase((s as OpenAPIV3.SchemaObject).title)]\n : [...nameParts, pascalCase(pattern), `${i}`],\n schema: s as OpenAPIV3.SchemaObject,\n propPath: ['patternProperties', pattern],\n })),\n ];\n\n // Hoist these recursively first (ie depth first search) so that we don't miss refs\n const recursiveRefs = inlineSubSchemas.flatMap((s) =>\n hoistInlineObjectSubSchemas(s.nameParts, s.schema, seenModelNameCounts),\n );\n\n // Clone the object subschemas to build the refs. Note that only objects with\n // \"properties\" are hoisted as these are non-dictionary types. `type` is\n // optional in OpenAPI and `properties` implies an object, so a schema written\n // without it counts — the parser classifies one the same way, and requiring\n // the explicit `type` left it inline where an `allOf` member is then taken for\n // a non-object and the whole document rejected.\n const isObjectSchema = (s: OpenAPIV3.SchemaObject): boolean =>\n (s.type === 'object' || s.type === undefined) &&\n !!(s.properties || (s as any).patternProperties);\n const refs = inlineSubSchemas\n .filter(\n (s) =>\n isObjectSchema(s.schema) ||\n isCompositeSchema(s.schema) ||\n (s.schema.type === 'string' && s.schema.enum),\n )\n .map((s) => {\n const name = createUniqueModelName(s.nameParts, seenModelNameCounts);\n\n const $ref = `#/components/schemas/${name}`;\n const ref = {\n $ref,\n name,\n schema: structuredClone({\n ...s.schema,\n 'x-aws-nx-hoisted': true,\n }),\n };\n\n // Replace each subschema with a ref in the spec. `nullable` describes this\n // use of the schema rather than the schema itself, so it stays beside the\n // ref: moving it onto the hoisted definition made a required nullable\n // object non-nullable here, and would have made every other user of the\n // hoisted schema nullable instead.\n const schemaWithPropToReplace = s.propPath\n .slice(0, -1)\n .reduce(\n (resolvedInSchema, pathPart) => resolvedInSchema?.[pathPart],\n schema,\n );\n if (schemaWithPropToReplace) {\n schemaWithPropToReplace[s.propPath[s.propPath.length - 1]] = s.schema\n .nullable\n ? { $ref, nullable: true }\n : { $ref };\n }\n\n return ref;\n });\n\n return [...refs, ...recursiveRefs];\n};\n\n/**\n * Rewrites OpenAPI 3.1 `const` schemas to the semantically equivalent `enum`\n * form. FastAPI emits `{type: 'string', const: 'X'}` for `Literal['X']`; the\n * parser understands the enum shape, whereas the const shape would synthesise\n * phantom named references.\n */\nconst rewriteConstToEnum = (spec: Spec): Spec => {\n const rewrite = (v: any): any => {\n if (\n v &&\n typeof v === 'object' &&\n !Array.isArray(v) &&\n 'const' in v &&\n !('enum' in v)\n ) {\n const { const: constValue, ...rest } = v;\n // Recurse with the same rewrite so consts nested within a rewritten\n // schema are also rewritten.\n return cloneDeepWith({ ...rest, enum: [constValue] }, rewrite);\n }\n };\n return cloneDeepWith(spec, rewrite);\n};\n\n/**\n * Rewrites a composite schema with sibling `properties`/`required` (a valid\n * JSON Schema conjunction, common in FastAPI/Pydantic output) into an\n * equivalent extra `allOf` member, so the parser sees a pure composite and the\n * sibling fields are neither dropped from the type nor stripped when\n * marshalling.\n */\nconst rewriteCompositeSiblingProperties = (spec: Spec): Spec => {\n const rewrite = (v: any): any => {\n if (\n v &&\n typeof v === 'object' &&\n !Array.isArray(v) &&\n Array.isArray(v.allOf) &&\n v.properties\n ) {\n const { properties, required, type: _type, ...rest } = v;\n return cloneDeepWith(\n {\n ...rest,\n allOf: [\n ...v.allOf,\n {\n type: 'object',\n properties,\n ...(required ? { required } : {}),\n },\n ],\n },\n rewrite,\n );\n }\n };\n return cloneDeepWith(spec, rewrite);\n};\n\n/**\n * Rewrites an OpenAPI 3.1 multi-type schema (`type: ['integer', 'string']`)\n * into the equivalent `anyOf` of single-type schemas, dropping `null` from the\n * list and marking the schema nullable instead. This lets the parser render a\n * proper union rather than collapsing to the first declared type.\n */\nconst rewriteMultiTypeToAnyOf = (spec: Spec): Spec => {\n const rewrite = (v: any): any => {\n if (\n v &&\n typeof v === 'object' &&\n !Array.isArray(v) &&\n Array.isArray(v.type) &&\n !('anyOf' in v) &&\n !('oneOf' in v) &&\n !('allOf' in v) &&\n !('enum' in v)\n ) {\n const { type, nullable, ...rest } = v;\n const nonNull = (type as string[]).filter((t) => t !== 'null');\n const isNullable = nullable === true || nonNull.length !== type.length;\n // Recurse with the same rewrite so multi-type schemas nested within a\n // rewritten schema (e.g. the items of a nullable array) are also\n // rewritten.\n // A single non-null type is not a union; keep it as a plain typed schema.\n if (nonNull.length <= 1) {\n return cloneDeepWith(\n {\n ...rest,\n ...(nonNull.length === 1 ? { type: nonNull[0] } : {}),\n ...(isNullable ? { nullable: true } : {}),\n },\n rewrite,\n );\n }\n return cloneDeepWith(\n {\n ...rest,\n anyOf: nonNull.map((t) => ({ type: t })),\n ...(isNullable ? { nullable: true } : {}),\n },\n rewrite,\n );\n }\n };\n return cloneDeepWith(spec, rewrite);\n};\n\n/**\n * Inlines `$ref` path items so that every operation is visited by the\n * normalisation below (operationId assignment, schema hoisting). Each path\n * gets its own copy, so paths sharing a path item are normalised\n * independently.\n */\nconst inlinePathItemRefs = (spec: Spec): void => {\n Object.entries(spec.paths ?? {}).forEach(([path, pathItem]) => {\n if (isRef(pathItem)) {\n const { $ref, ...rest } = pathItem;\n spec.paths![path] = {\n ...structuredClone(resolveRef(spec, $ref)),\n ...rest,\n };\n }\n });\n};\n\n/**\n * In order to ensure we generate models consistently whether or not users used refs or inline schemas,\n * we hoist any inline refs to non-primitives\n */\nexport const normaliseOpenApiSpecForCodeGen = (inSpec: Spec): Spec => {\n // Clone the spec so we're free to mutate it\n let spec = cloneDeepWith(inSpec);\n\n inlinePathItemRefs(spec);\n spec = rewriteConstToEnum(spec);\n spec = rewriteMultiTypeToAnyOf(spec);\n spec = rewriteCompositeSiblingProperties(spec);\n\n // Ensure spec has schemas set\n if (!spec?.components?.schemas) {\n spec.components = {\n ...spec.components,\n };\n spec.components.schemas = {\n ...spec.components.schemas,\n };\n }\n\n const seenOperationIds = new Set<string>();\n const duplicatedOperationIds = new Set<string>();\n\n // Make sure all operationIds are camelCase, and find which ones are duplicated\n Object.entries(spec.paths ?? {}).forEach(([path, pathOps]) =>\n Object.entries(pathOps ?? {}).forEach(([method, op]) => {\n const operation = resolveIfRef(spec, op);\n if (operation && typeof operation === 'object') {\n const operationId = camelCase(\n (operation as any).operationId ?? `${method}-${path}`,\n );\n (operation as any).operationId = operationId;\n if (seenOperationIds.has(operationId)) {\n duplicatedOperationIds.add(operationId);\n }\n seenOperationIds.add(operationId);\n }\n }),\n );\n\n // Reset seen operation ids\n seenOperationIds.clear();\n\n const untagged = Symbol('untagged');\n const seenOperationIdsByTag: { [tag: string | symbol]: Set<string> } = {};\n\n // \"Hoist\" inline request and response schemas\n Object.entries(spec.paths ?? {}).forEach(([path, pathOps]) =>\n Object.entries(pathOps ?? {}).forEach(([method, op]) => {\n const operation = resolveIfRef(spec, op);\n if (operation && typeof operation === 'object') {\n const tags: string[] = (operation as any).tags ?? [];\n const operationId = (operation as any).operationId as string;\n\n // Allow operations to have the same id\n let deduplicatedOpId = operationId;\n let deduplicatedDotNotationOpId = operationId;\n\n // Attempt to deduplicate the operationId by its tags\n if (duplicatedOperationIds.has(operationId)) {\n deduplicatedOpId = camelCase(\n tags.map((t) => `${t}-`).join('') + operationId,\n );\n deduplicatedDotNotationOpId =\n tags.map((t) => `${camelCase(t)}.`).join('') +\n camelCase(operationId);\n }\n\n (operation as any)['x-aws-nx-deduplicated-op-id'] = deduplicatedOpId;\n (operation as any)['x-aws-nx-deduplicated-dot-op-id'] =\n deduplicatedDotNotationOpId;\n\n seenOperationIds.add(deduplicatedOpId);\n\n // Throw an error for any duplicated operation ids with the same tag, or untagged\n [...(tags.length === 0 ? [untagged] : tags)].forEach((tag) => {\n if (\n seenOperationIdsByTag[tag] &&\n seenOperationIdsByTag[tag].has(operationId)\n ) {\n throw new Error(\n tag === untagged\n ? `Untagged operations cannot have the same operationId (${operationId})`\n : `Operations with the same tag (${String(tag)}) cannot have the same operationId (${operationId})`,\n );\n }\n\n seenOperationIdsByTag[tag] = new Set([\n ...(seenOperationIdsByTag[tag] ?? []),\n operationId,\n ]);\n });\n\n if ('responses' in operation) {\n Object.entries(operation.responses ?? {}).forEach(([code, res]) => {\n const response = resolveIfRef(spec, res);\n const jsonMediaType = preferredJsonMediaType(\n Object.keys(response?.content ?? {}),\n );\n const jsonResponseSchema = jsonMediaType\n ? response!.content![jsonMediaType].schema\n : undefined;\n if (\n jsonResponseSchema &&\n !isRef(jsonResponseSchema) &&\n (['object', 'array'].includes(jsonResponseSchema.type!) ||\n isCompositeSchema(jsonResponseSchema) ||\n (jsonResponseSchema?.type === 'string' &&\n jsonResponseSchema.enum))\n ) {\n const schemaName = `${upperFirst(deduplicatedOpId)}${code}Response`;\n spec.components!.schemas![schemaName] = jsonResponseSchema;\n response!.content![jsonMediaType!].schema = {\n $ref: `#/components/schemas/${schemaName}`,\n };\n }\n\n // Hoist inline streaming item schemas (OpenAPI 3.2 itemSchema) so\n // each streamed item gets a named model.\n STREAMING_CONTENT_TYPES.forEach((mediaType) => {\n const streamingContent = response?.content?.[mediaType] as\n | { itemSchema?: OpenAPIV3.SchemaObject }\n | undefined;\n const itemSchema = streamingContent?.itemSchema;\n if (\n itemSchema &&\n !isRef(itemSchema) &&\n (['object', 'array'].includes(itemSchema.type!) ||\n isCompositeSchema(itemSchema) ||\n (itemSchema.type === 'string' && itemSchema.enum))\n ) {\n const schemaName = `${upperFirst(deduplicatedOpId)}${code}ResponseItem`;\n spec.components!.schemas![schemaName] = itemSchema;\n streamingContent.itemSchema = {\n $ref: `#/components/schemas/${schemaName}`,\n } as OpenAPIV3.SchemaObject;\n }\n });\n });\n }\n if ('requestBody' in operation) {\n const requestBody = resolveIfRef(spec, operation.requestBody);\n const contentMediaTypes = Object.keys(requestBody?.content ?? {});\n // Hoist the JSON body, falling back to a form-data body (multipart or\n // urlencoded) so an inline form object is fully typed and marshalled\n // rather than left `unknown`.\n const bodyMediaType =\n preferredJsonMediaType(contentMediaTypes) ??\n contentMediaTypes.find(isFormMediaType);\n const bodyContentSchema = bodyMediaType\n ? requestBody!.content![bodyMediaType].schema\n : undefined;\n // A form body's binary string fields are file uploads (Blob). Mark\n // the resolved schema (inline or $ref target) before hoisting.\n if (bodyMediaType && isFormMediaType(bodyMediaType)) {\n const resolved = resolveIfRef(spec, bodyContentSchema) as\n | OpenAPIV3.SchemaObject\n | undefined;\n if (resolved) markFormBinaryFields(resolved);\n }\n if (\n bodyContentSchema &&\n !isRef(bodyContentSchema) &&\n (['object', 'array'].includes(bodyContentSchema.type!) ||\n isCompositeSchema(bodyContentSchema) ||\n (bodyContentSchema?.type === 'string' && bodyContentSchema.enum))\n ) {\n const schemaName = `${upperFirst(deduplicatedOpId)}RequestContent`;\n spec.components!.schemas![schemaName] = bodyContentSchema;\n requestBody!.content![bodyMediaType!].schema = {\n $ref: `#/components/schemas/${schemaName}`,\n };\n }\n }\n\n // Hoist parameter schemas. Composite and inline-object schemas are\n // hoisted to named models so the parameter is fully typed (e.g. a\n // `deepObject` query param's members are marshalled, not left `unknown`).\n if ('parameters' in operation) {\n (operation.parameters ?? []).forEach((p) => {\n const param = resolveIfRef(spec, p);\n const paramSchema = param?.schema as\n | OpenAPIV3.SchemaObject\n | undefined;\n if (\n paramSchema &&\n !isRef(paramSchema) &&\n (isCompositeSchema(paramSchema) ||\n (paramSchema.type === 'object' && !!paramSchema.properties))\n ) {\n const schemaName = `${upperFirst(deduplicatedOpId)}Request${upperFirst(param.in)}${upperFirst(camelCase(param.name))}`;\n spec.components!.schemas![schemaName] = paramSchema;\n param.schema = { $ref: `#/components/schemas/${schemaName}` };\n }\n });\n }\n }\n }),\n );\n\n // Normalize schema names to valid TypeScript identifiers (e.g., \"Message-Output\" -> \"MessageOutput\")\n spec = normaliseSchemaNames(spec);\n\n // Initialise the models that we have seen with all schemas.\n // This is required to ensure we do not create any clashing models below\n const seenModelNameCounts = Object.fromEntries(\n Object.keys(spec.components?.schemas ?? {}).map((name) => [name, 1]),\n );\n\n // \"Hoist\" any nested object definitions in arrays/maps that aren't already refs, as parseOpenapi will treat the\n // type as \"any\" if they're defined inline (and not a ref)\n Object.entries(spec.components?.schemas ?? {}).forEach(([name, schema]) => {\n if (!isRef(schema)) {\n const refs = hoistInlineObjectSubSchemas(\n [name],\n schema,\n seenModelNameCounts,\n );\n refs.forEach((ref) => {\n spec.components!.schemas![ref.name] = ref.schema;\n });\n }\n });\n\n // \"Inline\" any refs to non objects/enums.\n //\n // The substituted body is itself walked for refs, so a chain — an array whose\n // items are a named scalar — collapses in one pass. Substituting the array\n // without following through left `items` pointing at a schema this same pass\n // deletes, so the client referred to a type nothing declared and the emitted\n // TypeScript did not compile.\n const inlinedRefs: Set<string> = new Set();\n const inlineNonObjectRefs = (value: unknown): unknown =>\n cloneDeepWith(value, (v) => {\n if (v && typeof v === 'object' && v.$ref) {\n const resolved = resolveRef(spec, v.$ref);\n if (\n resolved &&\n resolved.type &&\n resolved.type !== 'object' &&\n !(resolved.type === 'string' && resolved.enum)\n ) {\n inlinedRefs.add(v.$ref);\n return inlineNonObjectRefs(resolved);\n }\n }\n });\n spec = inlineNonObjectRefs(spec) as Spec;\n\n // Delete the non object schemas that were inlined\n [...inlinedRefs].forEach((ref) => {\n const parts = splitRef(ref);\n if (\n parts.length === 3 &&\n parts[0] === 'components' &&\n parts[1] === 'schemas'\n ) {\n delete spec.components!.schemas![parts[2]];\n }\n });\n\n return spec;\n};\n"],"names":["cloneDeepWith","camelCase","pascalCase","toClassName","upperFirst","STREAMING_CONTENT_TYPES","isRef","resolveIfRef","resolveRef","splitRef","normaliseSchemaNames","spec","schemaNameMapping","originalNames","Object","keys","components","schemas","existingSchemaNames","Set","resolvedNameOwners","forEach","name","normalizedName","has","Error","owner","undefined","length","v","parts","$ref","oldName","newName","entries","schema","isCompositeSchema","allOf","anyOf","oneOf","preferredJsonMediaType","mediaTypes","find","mediaType","split","endsWith","FORM_MEDIA_TYPES","isFormMediaType","includes","isBinaryContentMediaType","contentMediaType","startsWith","markFormBinaryFields","values","properties","prop","s","type","format","contentEncoding","hasSubSchemasToVisit","patternProperties","not","enum","filterInlineCompositeSchemas","nameParts","namePartPrefix","propPath","inlineSchemaIndex","flatMap","i","subSchema","title","createUniqueModelName","seenModelNameCounts","candidateName","map","join","seenModelNameCount","hoistInlineObjectSubSchemas","inlineSubSchemas","items","prefixItems","filter","additionalProperties","pattern","recursiveRefs","isObjectSchema","refs","ref","structuredClone","schemaWithPropToReplace","slice","reduce","resolvedInSchema","pathPart","nullable","rewriteConstToEnum","rewrite","Array","isArray","const","constValue","rest","rewriteCompositeSiblingProperties","required","_type","rewriteMultiTypeToAnyOf","nonNull","t","isNullable","inlinePathItemRefs","paths","path","pathItem","normaliseOpenApiSpecForCodeGen","inSpec","seenOperationIds","duplicatedOperationIds","pathOps","method","op","operation","operationId","add","clear","untagged","Symbol","seenOperationIdsByTag","tags","deduplicatedOpId","deduplicatedDotNotationOpId","tag","String","responses","code","res","response","jsonMediaType","content","jsonResponseSchema","schemaName","streamingContent","itemSchema","requestBody","contentMediaTypes","bodyMediaType","bodyContentSchema","resolved","parameters","p","param","paramSchema","in","fromEntries","inlinedRefs","inlineNonObjectRefs","value"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,mBAAmB,uBAAuB;AAEjD,SACEC,SAAS,EACTC,UAAU,EACVC,WAAW,EACXC,UAAU,QACL,uBAAuB;AAC9B,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,KAAK,EAAEC,YAAY,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,YAAY;AAetE;;;;CAIC,GACD,MAAMC,uBAAuB,CAACC;IAC5B,MAAMC,oBAAmD,CAAC;IAC1D,MAAMC,gBAAgBC,OAAOC,IAAI,CAACJ,KAAKK,UAAU,EAAEC,WAAW,CAAC;IAC/D,MAAMC,sBAAsB,IAAIC,IAAIN;IAEpC,2EAA2E;IAC3E,0EAA0E;IAC1E,qCAAqC;IACrC,MAAMO,qBAAyD,CAAC;IAEhE,0CAA0C;IAC1CP,cAAcQ,OAAO,CAAC,CAACC;QACrB,MAAMC,iBAAiBpB,YAAYmB;QACnC,IAAIC,mBAAmBD,MAAM;YAC3B,mEAAmE;YACnE,IAAIJ,oBAAoBM,GAAG,CAACD,iBAAiB;gBAC3C,MAAM,IAAIE,MACR,CAAC,qCAAqC,EAAEH,KAAK,0BAA0B,EAAEC,eAAe,gHAAgH,CAAC;YAE7M;YACAX,iBAAiB,CAACU,KAAK,GAAGC;QAC5B;QAEA,yEAAyE;QACzE,mEAAmE;QACnE,kCAAkC;QAClC,MAAMG,QAAQN,kBAAkB,CAACG,eAAe;QAChD,IAAIG,UAAUC,WAAW;YACvB,MAAM,IAAIF,MACR,CAAC,qCAAqC,EAAEH,KAAK,OAAO,EAAEI,MAAM,qBAAqB,EAAEH,eAAe,oEAAoE,CAAC;QAE3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../../packages/nx-plugin/src/open-api/utils/normalise.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport cloneDeepWith from 'lodash.clonedeepwith';\nimport type { OpenAPIV3 } from 'openapi-types';\nimport {\n camelCase,\n pascalCase,\n toClassName,\n upperFirst,\n} from '../../utils/names.js';\nimport { STREAMING_CONTENT_TYPES } from './codegen-data/types.js';\nimport { isRef, resolveIfRef, resolveRef, splitRef } from './refs.js';\nimport type { Spec } from './types.js';\n\ninterface SubSchema {\n readonly nameParts: string[];\n readonly schema: OpenAPIV3.SchemaObject;\n readonly propPath: (string | number)[];\n}\n\ninterface SubSchemaRef {\n readonly $ref: string;\n readonly name: string;\n readonly schema: OpenAPIV3.SchemaObject;\n}\n\n/**\n * Normalise schema names to valid TypeScript identifiers.\n * Converts names with hyphens or other invalid characters to PascalCase.\n * Throws an error if normalisation would create a name clash.\n */\nconst normaliseSchemaNames = (spec: Spec): Spec => {\n const schemaNameMapping: { [oldName: string]: string } = {};\n const originalNames = Object.keys(spec.components?.schemas ?? {});\n const existingSchemaNames = new Set(originalNames);\n\n // The name each schema resolves to (its normalised form, or itself when it\n // needs no normalisation). Used to detect two distinct schemas that would\n // collapse onto the same identifier.\n const resolvedNameOwners: { [resolvedName: string]: string } = {};\n\n // Build mapping of old names to new names\n originalNames.forEach((name) => {\n const normalizedName = toClassName(name);\n if (normalizedName !== name) {\n // Check if the normalized name would clash with an existing schema\n if (existingSchemaNames.has(normalizedName)) {\n throw new Error(\n `Schema name normalization conflict: \"${name}\" would be normalized to \"${normalizedName}\", but a schema with that name already exists. Please rename one of these schemas in your OpenAPI specification.`,\n );\n }\n schemaNameMapping[name] = normalizedName;\n }\n\n // Detect two distinct schemas resolving to the same name (e.g. \"Foo-Bar\"\n // and \"Foo.Bar\" both normalise to \"FooBar\"), which would otherwise\n // silently overwrite one another.\n const owner = resolvedNameOwners[normalizedName];\n if (owner !== undefined) {\n throw new Error(\n `Schema name normalization conflict: \"${name}\" and \"${owner}\" both normalize to \"${normalizedName}\". Please rename one of these schemas in your OpenAPI specification.`,\n );\n }\n resolvedNameOwners[normalizedName] = name;\n });\n\n // If no normalization needed, return spec as-is\n if (Object.keys(schemaNameMapping).length === 0) {\n return spec;\n }\n\n /** The renamed form of a schema reference, or undefined if it is unaffected. */\n const renamedRef = (ref: string): string | undefined => {\n const parts = splitRef(ref);\n if (\n parts.length !== 3 ||\n parts[0] !== 'components' ||\n parts[1] !== 'schemas'\n ) {\n return undefined;\n }\n const newName = schemaNameMapping[parts[2]];\n return newName ? `#/components/schemas/${newName}` : undefined;\n };\n\n // Update all $ref references throughout the spec\n spec = cloneDeepWith(spec, (v) => {\n if (isRef(v)) {\n const renamed = renamedRef(v.$ref);\n if (renamed) {\n return { $ref: renamed };\n }\n }\n // A `discriminator.mapping` value is a bare reference string, not a `$ref`\n // object, so it is rewritten here. Left stale it no longer resolves, and a\n // tagged union silently degrades to an untagged one — which can parse a\n // response into the wrong branch rather than failing.\n if (\n v &&\n typeof v === 'object' &&\n !Array.isArray(v) &&\n typeof (v as { propertyName?: unknown }).propertyName === 'string' &&\n (v as { mapping?: unknown }).mapping &&\n typeof (v as { mapping?: unknown }).mapping === 'object'\n ) {\n const discriminator = v as {\n propertyName: string;\n mapping: Record<string, string>;\n };\n return {\n ...discriminator,\n mapping: Object.fromEntries(\n Object.entries(discriminator.mapping).map(([value, ref]) => [\n value,\n typeof ref === 'string' ? (renamedRef(ref) ?? ref) : ref,\n ]),\n ),\n };\n }\n });\n\n // Rename schema keys, recording the original name so downstream code can\n // recover the on-the-wire value (e.g. an implicit discriminator matches on\n // the original schema name, not its normalised identifier).\n Object.entries(schemaNameMapping).forEach(([oldName, newName]) => {\n const schema = spec.components!.schemas![oldName];\n if (schema && !isRef(schema)) {\n (schema as { 'x-aws-nx-original-name'?: string })[\n 'x-aws-nx-original-name'\n ] = oldName;\n }\n spec.components!.schemas![newName] = schema;\n delete spec.components!.schemas![oldName];\n });\n\n return spec;\n};\n\nconst isCompositeSchema = (schema: OpenAPIV3.SchemaObject) =>\n !!schema.allOf || !!schema.anyOf || !!schema.oneOf;\n\n/**\n * The media type whose schema is hoisted for a request/response: prefer\n * `application/json`, falling back to any `+json` vendored type (e.g.\n * `application/problem+json`).\n *\n * Parameters are stripped before matching, as they are for the `+json` fallback:\n * a media type's parameters do not identify it (RFC 9110 §8.3), and matching\n * `application/json` exactly meant `application/json; charset=utf-8` — a common\n * spelling — hoisted nothing, so the response type resolved to a name that was\n * never declared.\n */\nconst baseMediaType = (mediaType: string): string =>\n mediaType.split(';')[0].trim();\n\nconst preferredJsonMediaType = (mediaTypes: string[]): string | undefined =>\n mediaTypes.find(\n (mediaType) => baseMediaType(mediaType) === 'application/json',\n ) ??\n mediaTypes.find((mediaType) => baseMediaType(mediaType).endsWith('+json'));\n\nconst FORM_MEDIA_TYPES = [\n 'multipart/form-data',\n 'application/x-www-form-urlencoded',\n];\n\nconst isFormMediaType = (mediaType: string): boolean =>\n FORM_MEDIA_TYPES.includes(mediaType.split(';')[0]);\n\n/**\n * Whether a `contentMediaType` denotes binary (rather than textual/JSON)\n * content — an octet-stream, image, audio, etc.\n */\nconst isBinaryContentMediaType = (contentMediaType: string): boolean =>\n !(\n contentMediaType.startsWith('text/') ||\n contentMediaType === 'application/json' ||\n contentMediaType.endsWith('+json') ||\n contentMediaType === 'application/xml'\n );\n\n/**\n * Rewrite a binary string schema, and any nested within it, to `format: binary`\n * so the generator types it as a file rather than text.\n *\n * A base64 `contentEncoding` or a textual/JSON `contentMediaType` keeps the\n * schema a string, and `format: binary` is left untouched (already binary\n * anywhere). Nesting is walked because a file is not always a bare property:\n * `list[UploadFile]` puts it under `items` and `UploadFile | None` under\n * `anyOf`, and an element left unmarked stayed a `str`, so it was sent as a text\n * part the server rejected.\n *\n * Callers decide *where* this applies, since FastAPI emits the same schema\n * (`{type: string, contentMediaType: ...}`) for a multipart file field and for\n * `bytes` in a JSON body — only the enclosing media type tells them apart.\n */\nconst markBinaryStringSchema = (schema: unknown): void => {\n if (!schema || typeof schema !== 'object' || isRef(schema)) return;\n const s = schema as OpenAPIV3.SchemaObject & {\n contentMediaType?: string;\n contentEncoding?: string;\n // `items` is declared only on the array branch of `SchemaObject`, and\n // `prefixItems` not at all; both are read here without narrowing `type`\n // first, since a form body may omit it.\n items?: unknown;\n prefixItems?: unknown[];\n };\n if (\n s.type === 'string' &&\n s.format !== 'binary' &&\n s.contentMediaType &&\n !s.contentEncoding &&\n isBinaryContentMediaType(s.contentMediaType)\n ) {\n s.format = 'binary';\n return;\n }\n markBinaryStringSchema(s.items);\n for (const member of [\n ...(s.anyOf ?? []),\n ...(s.oneOf ?? []),\n ...(s.allOf ?? []),\n ...(s.prefixItems ?? []),\n ]) {\n markBinaryStringSchema(member);\n }\n};\n\n/** A form body's binary string fields are file uploads. */\nconst markFormBinaryFields = (schema: OpenAPIV3.SchemaObject): void => {\n Object.values(schema.properties ?? {}).forEach(markBinaryStringSchema);\n};\n\nconst hasSubSchemasToVisit = (\n schema?: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject,\n): schema is OpenAPIV3.SchemaObject =>\n !!schema &&\n !isRef(schema) &&\n (['object', 'array'].includes(schema.type as any) ||\n // `type` is optional, and `properties` implies an object — which is how the\n // parser already classifies one. Requiring the explicit `type` left such a\n // schema unhoisted, so an `allOf` member written that way stayed inline and\n // was taken for a non-object, rejecting the whole document.\n !!schema.properties ||\n // `patternProperties` is JSON Schema, so it is not on the 3.0 type.\n !!(schema as { patternProperties?: unknown }).patternProperties ||\n isCompositeSchema(schema) ||\n !!schema.not ||\n (schema.type === 'string' && !!schema.enum));\n\nconst filterInlineCompositeSchemas = (\n schemas: (OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject)[],\n nameParts: string[],\n namePartPrefix: string,\n propPath: (string | number)[],\n): SubSchema[] => {\n let inlineSchemaIndex = 0;\n return schemas.flatMap((s, i) => {\n if (hasSubSchemasToVisit(s)) {\n const subSchema: SubSchema = {\n nameParts: s.title\n ? [pascalCase(s.title)]\n : [\n ...nameParts,\n `${namePartPrefix}${inlineSchemaIndex === 0 ? '' : inlineSchemaIndex}`,\n ],\n schema: s,\n propPath: [...propPath, i],\n };\n inlineSchemaIndex++;\n return [subSchema];\n }\n return [];\n });\n};\n\n/**\n * Returns a unique model/schema name for any models which we hoist\n */\nconst createUniqueModelName = (\n nameParts: string[],\n seenModelNameCounts: { [name: string]: number },\n): string => {\n // Normalise each part to a class-name form (stripping `_`, hyphens, etc) so\n // the hoisted schema name matches what `toTypeScriptModelName`/`toClassName`\n // later derive — otherwise a part like `store_photos` yields a `Store_photos`\n // schema whose reference (`StorePhotos`) no longer resolves.\n const candidateName = nameParts.map(toClassName).join('');\n\n // We have not seen this name so we're free to use it\n if (seenModelNameCounts[candidateName] === undefined) {\n seenModelNameCounts[candidateName] = 1;\n return candidateName;\n }\n\n // We have seen the name before, so we must disambiguate. The suffixed name\n // needs checking too: a declared schema may already be called `FooBar1`, and\n // taking it silently replaced the user's schema with the hoisted one.\n let suffixed = `${candidateName}${seenModelNameCounts[candidateName]++}`;\n while (seenModelNameCounts[suffixed] !== undefined) {\n suffixed = `${candidateName}${seenModelNameCounts[candidateName]++}`;\n }\n seenModelNameCounts[suffixed] = 1;\n return suffixed;\n};\n\nconst hoistInlineObjectSubSchemas = (\n nameParts: string[],\n schema: OpenAPIV3.SchemaObject,\n seenModelNameCounts: { [name: string]: number },\n): SubSchemaRef[] => {\n // Find all the inline subschemas we should visit\n const inlineSubSchemas: SubSchema[] = [\n ...(hasSubSchemasToVisit(schema.not)\n ? [\n {\n nameParts: schema.not?.title\n ? [pascalCase(schema.not?.title)]\n : [...nameParts, 'Not'],\n schema: schema.not,\n propPath: ['not'],\n },\n ]\n : []),\n ...(schema.anyOf\n ? filterInlineCompositeSchemas(schema.anyOf, nameParts, 'AnyOf', [\n 'anyOf',\n ])\n : []),\n ...(schema.allOf\n ? filterInlineCompositeSchemas(schema.allOf, nameParts, 'AllOf', [\n 'allOf',\n ])\n : []),\n ...(schema.oneOf\n ? filterInlineCompositeSchemas(schema.oneOf, nameParts, 'OneOf', [\n 'oneOf',\n ])\n : []),\n ...('items' in schema && hasSubSchemasToVisit(schema.items)\n ? [\n {\n nameParts: schema.items?.title\n ? [pascalCase(schema.items?.title)]\n : [...nameParts, 'Item'],\n schema: schema.items,\n propPath: ['items'],\n },\n ]\n : []),\n ...(\n (schema as { prefixItems?: OpenAPIV3.SchemaObject[] }).prefixItems ?? []\n ).flatMap((s, i) =>\n hasSubSchemasToVisit(s)\n ? [\n {\n nameParts: s.title\n ? [pascalCase(s.title)]\n : [...nameParts, 'Item', `${i}`],\n schema: s,\n propPath: ['prefixItems', i],\n },\n ]\n : [],\n ),\n ...Object.entries(schema.properties ?? {})\n .filter(([, s]) => hasSubSchemasToVisit(s))\n .map(([name, s]) => ({\n nameParts: (s as OpenAPIV3.SchemaObject).title\n ? [pascalCase((s as OpenAPIV3.SchemaObject).title)]\n : [...nameParts, name],\n schema: s as OpenAPIV3.SchemaObject,\n propPath: ['properties', name],\n })),\n ...(typeof schema.additionalProperties !== 'boolean' &&\n hasSubSchemasToVisit(schema.additionalProperties)\n ? [\n {\n nameParts: schema.additionalProperties?.title\n ? [pascalCase(schema.additionalProperties?.title)]\n : [...nameParts, 'Value'],\n schema: schema.additionalProperties,\n propPath: ['additionalProperties'],\n },\n ]\n : []),\n ...Object.entries((schema as any).patternProperties ?? {})\n .filter(([, s]) => hasSubSchemasToVisit(s))\n .map(([pattern, s], i) => ({\n nameParts: (s as OpenAPIV3.SchemaObject).title\n ? [pascalCase((s as OpenAPIV3.SchemaObject).title)]\n : [...nameParts, pascalCase(pattern), `${i}`],\n schema: s as OpenAPIV3.SchemaObject,\n propPath: ['patternProperties', pattern],\n })),\n ];\n\n // Hoist these recursively first (ie depth first search) so that we don't miss refs\n const recursiveRefs = inlineSubSchemas.flatMap((s) =>\n hoistInlineObjectSubSchemas(s.nameParts, s.schema, seenModelNameCounts),\n );\n\n // Clone the object subschemas to build the refs. Note that only objects with\n // \"properties\" are hoisted as these are non-dictionary types. `type` is\n // optional in OpenAPI and `properties` implies an object, so a schema written\n // without it counts — the parser classifies one the same way, and requiring\n // the explicit `type` left it inline where an `allOf` member is then taken for\n // a non-object and the whole document rejected.\n const isObjectSchema = (s: OpenAPIV3.SchemaObject): boolean =>\n (s.type === 'object' || s.type === undefined) &&\n !!(s.properties || (s as any).patternProperties);\n const refs = inlineSubSchemas\n .filter(\n (s) =>\n isObjectSchema(s.schema) ||\n isCompositeSchema(s.schema) ||\n (s.schema.type === 'string' && s.schema.enum),\n )\n .map((s) => {\n const name = createUniqueModelName(s.nameParts, seenModelNameCounts);\n\n const $ref = `#/components/schemas/${name}`;\n const ref = {\n $ref,\n name,\n schema: structuredClone({\n ...s.schema,\n 'x-aws-nx-hoisted': true,\n }),\n };\n\n // Replace each subschema with a ref in the spec. `nullable` describes this\n // use of the schema rather than the schema itself, so it stays beside the\n // ref: moving it onto the hoisted definition made a required nullable\n // object non-nullable here, and would have made every other user of the\n // hoisted schema nullable instead.\n const schemaWithPropToReplace = s.propPath\n .slice(0, -1)\n .reduce(\n (resolvedInSchema, pathPart) => resolvedInSchema?.[pathPart],\n schema,\n );\n if (schemaWithPropToReplace) {\n schemaWithPropToReplace[s.propPath[s.propPath.length - 1]] = s.schema\n .nullable\n ? { $ref, nullable: true }\n : { $ref };\n }\n\n return ref;\n });\n\n return [...refs, ...recursiveRefs];\n};\n\n/**\n * Rewrites OpenAPI 3.1 `const` schemas to the semantically equivalent `enum`\n * form. FastAPI emits `{type: 'string', const: 'X'}` for `Literal['X']`; the\n * parser understands the enum shape, whereas the const shape would synthesise\n * phantom named references.\n */\nconst rewriteConstToEnum = (spec: Spec): Spec => {\n const rewrite = (v: any): any => {\n if (\n v &&\n typeof v === 'object' &&\n !Array.isArray(v) &&\n 'const' in v &&\n !('enum' in v)\n ) {\n const { const: constValue, ...rest } = v;\n // Recurse with the same rewrite so consts nested within a rewritten\n // schema are also rewritten.\n return cloneDeepWith({ ...rest, enum: [constValue] }, rewrite);\n }\n };\n return cloneDeepWith(spec, rewrite);\n};\n\n/**\n * Rewrites a composite schema with sibling `properties`/`required` (a valid\n * JSON Schema conjunction, common in FastAPI/Pydantic output) into an\n * equivalent extra `allOf` member, so the parser sees a pure composite and the\n * sibling fields are neither dropped from the type nor stripped when\n * marshalling.\n */\nconst rewriteCompositeSiblingProperties = (spec: Spec): Spec => {\n const rewrite = (v: any): any => {\n if (\n v &&\n typeof v === 'object' &&\n !Array.isArray(v) &&\n Array.isArray(v.allOf) &&\n v.properties\n ) {\n const { properties, required, type: _type, ...rest } = v;\n return cloneDeepWith(\n {\n ...rest,\n allOf: [\n ...v.allOf,\n {\n type: 'object',\n properties,\n ...(required ? { required } : {}),\n },\n ],\n },\n rewrite,\n );\n }\n };\n return cloneDeepWith(spec, rewrite);\n};\n\n/**\n * Upper-cases wildcard response status codes (`2xx` to `2XX`), drops spec\n * extensions, and rejects a key that is neither.\n *\n * OpenAPI treats the range codes case-insensitively, but every consumer\n * downstream matches the upper-case form — a lower-case key would otherwise be\n * taken for a literal status code and emitted as one, which is not valid Python\n * or TypeScript. A key that is no kind of status code was emitted as a bare name\n * either way: `x-vendor-note` did not parse, and an alphabetic one like `unknown`\n * parsed and imported, then raised `NameError` from `response.status_code ==\n * unknown` only once that status arrived.\n */\nconst RESPONSE_CODE_PATTERN = /^(?:\\d{3}|\\d[xX]{2}|default)$/;\n\nconst normaliseResponseCodeCase = (spec: Spec): void => {\n for (const [path, pathItem] of Object.entries(spec.paths ?? {})) {\n for (const [method, operation] of Object.entries(pathItem ?? {})) {\n const responses = (operation as { responses?: Record<string, unknown> })\n ?.responses;\n if (!responses || typeof responses !== 'object') continue;\n for (const code of Object.keys(responses)) {\n // A `x-` extension is legal on the Responses Object and describes nothing\n // to generate, so it is dropped rather than rejected.\n if (code.startsWith('x-')) {\n delete responses[code];\n continue;\n }\n if (!RESPONSE_CODE_PATTERN.test(code)) {\n throw new Error(\n `Operation \"${method.toUpperCase()} ${path}\" declares a response keyed \"${code}\", which is not a status code, a wildcard range (such as \"5XX\") or \"default\". Please correct it in your OpenAPI specification.`,\n );\n }\n if (!/^\\d[xX]{2}$/.test(code) || code === code.toUpperCase()) continue;\n const upper = code.toUpperCase();\n // Both spellings name the same range, so one would silently overwrite\n // the other — and which survived would depend on key order. The repo\n // throws on a schema-name collision for the same reason.\n if (upper in responses) {\n throw new Error(\n `Response code conflict: \"${code}\" and \"${upper}\" describe the same status range. Please declare only one of them in your OpenAPI specification.`,\n );\n }\n responses[upper] = responses[code];\n delete responses[code];\n }\n }\n }\n};\n\n/**\n * Rewrites an OpenAPI 3.1 multi-type schema (`type: ['integer', 'string']`)\n * into the equivalent `anyOf` of single-type schemas, dropping `null` from the\n * list and marking the schema nullable instead. This lets the parser render a\n * proper union rather than collapsing to the first declared type.\n */\nconst rewriteMultiTypeToAnyOf = (spec: Spec): Spec => {\n const rewrite = (v: any): any => {\n if (\n v &&\n typeof v === 'object' &&\n !Array.isArray(v) &&\n Array.isArray(v.type) &&\n !('anyOf' in v) &&\n !('oneOf' in v) &&\n !('allOf' in v) &&\n !('enum' in v)\n ) {\n const { type, nullable, ...rest } = v;\n const nonNull = (type as string[]).filter((t) => t !== 'null');\n const isNullable = nullable === true || nonNull.length !== type.length;\n // Recurse with the same rewrite so multi-type schemas nested within a\n // rewritten schema (e.g. the items of a nullable array) are also\n // rewritten.\n // A single non-null type is not a union; keep it as a plain typed schema.\n if (nonNull.length <= 1) {\n return cloneDeepWith(\n {\n ...rest,\n ...(nonNull.length === 1 ? { type: nonNull[0] } : {}),\n ...(isNullable ? { nullable: true } : {}),\n },\n rewrite,\n );\n }\n return cloneDeepWith(\n {\n ...rest,\n anyOf: nonNull.map((t) => ({ type: t })),\n ...(isNullable ? { nullable: true } : {}),\n },\n rewrite,\n );\n }\n };\n return cloneDeepWith(spec, rewrite);\n};\n\n/**\n * Inlines `$ref` path items so that every operation is visited by the\n * normalisation below (operationId assignment, schema hoisting). Each path\n * gets its own copy, so paths sharing a path item are normalised\n * independently.\n */\nconst inlinePathItemRefs = (spec: Spec): void => {\n Object.entries(spec.paths ?? {}).forEach(([path, pathItem]) => {\n if (isRef(pathItem)) {\n const { $ref, ...rest } = pathItem;\n spec.paths![path] = {\n ...structuredClone(resolveRef(spec, $ref)),\n ...rest,\n };\n }\n });\n};\n\n/**\n * In order to ensure we generate models consistently whether or not users used refs or inline schemas,\n * we hoist any inline refs to non-primitives\n */\nexport const normaliseOpenApiSpecForCodeGen = (inSpec: Spec): Spec => {\n // Clone the spec so we're free to mutate it\n let spec = cloneDeepWith(inSpec);\n\n inlinePathItemRefs(spec);\n normaliseResponseCodeCase(spec);\n spec = rewriteConstToEnum(spec);\n spec = rewriteMultiTypeToAnyOf(spec);\n spec = rewriteCompositeSiblingProperties(spec);\n\n // Ensure spec has schemas set\n if (!spec?.components?.schemas) {\n spec.components = {\n ...spec.components,\n };\n spec.components.schemas = {\n ...spec.components.schemas,\n };\n }\n\n const seenOperationIds = new Set<string>();\n const duplicatedOperationIds = new Set<string>();\n\n // camelCasing is lossy — ids differing only in punctuation converge, and one\n // written entirely in punctuation converges on the empty string. Keep what the\n // document said so a rejection can name the operations the author has to change.\n const writtenOperationIds = new Map<object, string>();\n\n // Make sure all operationIds are camelCase, and find which ones are duplicated\n Object.entries(spec.paths ?? {}).forEach(([path, pathOps]) =>\n Object.entries(pathOps ?? {}).forEach(([method, op]) => {\n const operation = resolveIfRef(spec, op);\n if (operation && typeof operation === 'object') {\n const written = (operation as any).operationId ?? `${method}-${path}`;\n const operationId = camelCase(written);\n writtenOperationIds.set(operation, String(written));\n (operation as any).operationId = operationId;\n if (seenOperationIds.has(operationId)) {\n duplicatedOperationIds.add(operationId);\n }\n seenOperationIds.add(operationId);\n }\n }),\n );\n\n // Reset seen operation ids\n seenOperationIds.clear();\n\n const untagged = Symbol('untagged');\n const seenOperationIdsByTag: { [tag: string | symbol]: Set<string> } = {};\n\n // \"Hoist\" inline request and response schemas\n Object.entries(spec.paths ?? {}).forEach(([path, pathOps]) =>\n Object.entries(pathOps ?? {}).forEach(([method, op]) => {\n const operation = resolveIfRef(spec, op);\n if (operation && typeof operation === 'object') {\n const tags: string[] = (operation as any).tags ?? [];\n const operationId = (operation as any).operationId as string;\n\n // Allow operations to have the same id\n let deduplicatedOpId = operationId;\n let deduplicatedDotNotationOpId = operationId;\n\n // Attempt to deduplicate the operationId by its tags\n if (duplicatedOperationIds.has(operationId)) {\n deduplicatedOpId = camelCase(\n tags.map((t) => `${t}-`).join('') + operationId,\n );\n deduplicatedDotNotationOpId =\n tags.map((t) => `${camelCase(t)}.`).join('') +\n camelCase(operationId);\n }\n\n (operation as any)['x-aws-nx-deduplicated-op-id'] = deduplicatedOpId;\n (operation as any)['x-aws-nx-deduplicated-dot-op-id'] =\n deduplicatedDotNotationOpId;\n\n seenOperationIds.add(deduplicatedOpId);\n\n // Throw an error for any duplicated operation ids with the same tag, or\n // untagged. Keyed on the *normalised* tag: two tags that differ only in\n // punctuation (`my-tag` and `my.tag`) become one namespace downstream, so\n // ids that clash there clash for the client — and deduplicating by tag\n // cannot separate them, which silently dropped an operation.\n const normalisedTags: (string | symbol)[] =\n tags.length === 0\n ? [untagged]\n : [...new Set(tags.map((t) => camelCase(t)))];\n normalisedTags.forEach((tag) => {\n if (\n seenOperationIdsByTag[tag] &&\n seenOperationIdsByTag[tag].has(operationId)\n ) {\n // Report tag and id as written: either normalises to the empty\n // string when spelt with no alphanumerics, which names nothing to\n // the reader. `path` and `method` pin down which operation to edit.\n const tagsAsWritten = tags.map((t) => `\"${t}\"`).join(', ');\n const idAsWritten = `\"${writtenOperationIds.get(operation) ?? operationId}\"`;\n const at = `${method.toUpperCase()} ${path}`;\n throw new Error(\n tag === untagged\n ? `Untagged operations cannot have the same operationId (${idAsWritten}, at ${at})`\n : `Operations with the same tag (${tagsAsWritten}) cannot have the same operationId (${idAsWritten}, at ${at})`,\n );\n }\n\n seenOperationIdsByTag[tag] = new Set([\n ...(seenOperationIdsByTag[tag] ?? []),\n operationId,\n ]);\n });\n\n if ('responses' in operation) {\n Object.entries(operation.responses ?? {}).forEach(([code, res]) => {\n const response = resolveIfRef(spec, res);\n const jsonMediaType = preferredJsonMediaType(\n Object.keys(response?.content ?? {}),\n );\n const jsonResponseSchema = jsonMediaType\n ? response!.content![jsonMediaType].schema\n : undefined;\n if (\n jsonResponseSchema &&\n !isRef(jsonResponseSchema) &&\n (['object', 'array'].includes(jsonResponseSchema.type!) ||\n isCompositeSchema(jsonResponseSchema) ||\n (jsonResponseSchema?.type === 'string' &&\n jsonResponseSchema.enum))\n ) {\n const schemaName = `${upperFirst(deduplicatedOpId)}${code}Response`;\n spec.components!.schemas![schemaName] = jsonResponseSchema;\n response!.content![jsonMediaType!].schema = {\n $ref: `#/components/schemas/${schemaName}`,\n };\n }\n\n // Hoist inline streaming item schemas (OpenAPI 3.2 itemSchema) so\n // each streamed item gets a named model.\n STREAMING_CONTENT_TYPES.forEach((mediaType) => {\n const streamingContent = response?.content?.[mediaType] as\n | { itemSchema?: OpenAPIV3.SchemaObject }\n | undefined;\n const itemSchema = streamingContent?.itemSchema;\n if (\n itemSchema &&\n !isRef(itemSchema) &&\n (['object', 'array'].includes(itemSchema.type!) ||\n isCompositeSchema(itemSchema) ||\n (itemSchema.type === 'string' && itemSchema.enum))\n ) {\n const schemaName = `${upperFirst(deduplicatedOpId)}${code}ResponseItem`;\n spec.components!.schemas![schemaName] = itemSchema;\n streamingContent.itemSchema = {\n $ref: `#/components/schemas/${schemaName}`,\n } as OpenAPIV3.SchemaObject;\n }\n });\n });\n }\n if ('requestBody' in operation) {\n const requestBody = resolveIfRef(spec, operation.requestBody);\n const contentMediaTypes = Object.keys(requestBody?.content ?? {});\n // Hoist the JSON body, falling back to a form-data body (multipart or\n // urlencoded) so an inline form object is fully typed and marshalled\n // rather than left `unknown`.\n const bodyMediaType =\n preferredJsonMediaType(contentMediaTypes) ??\n contentMediaTypes.find(isFormMediaType);\n const bodyContentSchema = bodyMediaType\n ? requestBody!.content![bodyMediaType].schema\n : undefined;\n // A form body's binary string fields are file uploads (Blob). Mark\n // the resolved schema (inline or $ref target) before hoisting.\n if (bodyMediaType && isFormMediaType(bodyMediaType)) {\n const resolved = resolveIfRef(spec, bodyContentSchema) as\n | OpenAPIV3.SchemaObject\n | undefined;\n if (resolved) markFormBinaryFields(resolved);\n }\n // A whole body under a binary media type is itself the file. FastAPI\n // writes `bytes` as `{type: string, contentMediaType: ...}`, which\n // without this stayed a `str` and was sent as `repr(bytes)`.\n for (const mediaType of contentMediaTypes) {\n if (\n isFormMediaType(mediaType) ||\n !isBinaryContentMediaType(mediaType)\n ) {\n continue;\n }\n const schema = requestBody!.content![mediaType]?.schema;\n if (\n schema &&\n !isRef(schema) &&\n (schema as OpenAPIV3.SchemaObject).type === 'string'\n ) {\n (schema as OpenAPIV3.SchemaObject).format = 'binary';\n }\n }\n if (\n bodyContentSchema &&\n !isRef(bodyContentSchema) &&\n (['object', 'array'].includes(bodyContentSchema.type!) ||\n isCompositeSchema(bodyContentSchema) ||\n (bodyContentSchema?.type === 'string' && bodyContentSchema.enum))\n ) {\n const schemaName = `${upperFirst(deduplicatedOpId)}RequestContent`;\n spec.components!.schemas![schemaName] = bodyContentSchema;\n requestBody!.content![bodyMediaType!].schema = {\n $ref: `#/components/schemas/${schemaName}`,\n };\n }\n }\n\n // Hoist parameter schemas. Composite and inline-object schemas are\n // hoisted to named models so the parameter is fully typed (e.g. a\n // `deepObject` query param's members are marshalled, not left `unknown`).\n if ('parameters' in operation) {\n (operation.parameters ?? []).forEach((p) => {\n const param = resolveIfRef(spec, p);\n const paramSchema = param?.schema as\n | OpenAPIV3.SchemaObject\n | undefined;\n if (!paramSchema || isRef(paramSchema)) return;\n const schemaName = `${upperFirst(deduplicatedOpId)}Request${upperFirst(param.in)}${upperFirst(camelCase(param.name))}`;\n const needsName = (schema: OpenAPIV3.SchemaObject): boolean =>\n isCompositeSchema(schema) ||\n (schema.type === 'object' && !!schema.properties);\n if (needsName(paramSchema)) {\n spec.components!.schemas![schemaName] = paramSchema;\n param.schema = { $ref: `#/components/schemas/${schemaName}` };\n return;\n }\n // An array's items need a name of their own: left inline, a composite\n // there rendered as a member type nothing declared — `list[U]`, since\n // the anonymous schema's name escapes to nothing.\n // `items` is declared only on the array branch of `SchemaObject`.\n const items = (paramSchema as { items?: unknown }).items as\n | OpenAPIV3.SchemaObject\n | undefined;\n if (\n paramSchema.type === 'array' &&\n items &&\n !isRef(items) &&\n needsName(items)\n ) {\n const itemName = `${schemaName}Item`;\n spec.components!.schemas![itemName] = items;\n paramSchema.items = { $ref: `#/components/schemas/${itemName}` };\n }\n });\n }\n }\n }),\n );\n\n // Normalize schema names to valid TypeScript identifiers (e.g., \"Message-Output\" -> \"MessageOutput\")\n spec = normaliseSchemaNames(spec);\n\n // Initialise the models that we have seen with all schemas.\n // This is required to ensure we do not create any clashing models below\n const seenModelNameCounts = Object.fromEntries(\n Object.keys(spec.components?.schemas ?? {}).map((name) => [name, 1]),\n );\n\n // \"Hoist\" any nested object definitions in arrays/maps that aren't already refs, as parseOpenapi will treat the\n // type as \"any\" if they're defined inline (and not a ref)\n Object.entries(spec.components?.schemas ?? {}).forEach(([name, schema]) => {\n if (!isRef(schema)) {\n const refs = hoistInlineObjectSubSchemas(\n [name],\n schema,\n seenModelNameCounts,\n );\n refs.forEach((ref) => {\n spec.components!.schemas![ref.name] = ref.schema;\n });\n }\n });\n\n // \"Inline\" any refs to non objects/enums.\n //\n // The substituted body is itself walked for refs, so a chain — an array whose\n // items are a named scalar — collapses in one pass. Substituting the array\n // without following through left `items` pointing at a schema this same pass\n // deletes, so the client referred to a type nothing declared — the emitted\n // TypeScript did not compile, and the Python raised `AttributeError` on every\n // call, which neither parsing nor importing the package reveals.\n const inlinedRefs: Set<string> = new Set();\n const inlineNonObjectRefs = (value: unknown): unknown =>\n cloneDeepWith(value, (v) => {\n if (v && typeof v === 'object' && v.$ref) {\n const resolved = resolveRef(spec, v.$ref);\n if (\n resolved &&\n resolved.type &&\n resolved.type !== 'object' &&\n !(resolved.type === 'string' && resolved.enum)\n ) {\n inlinedRefs.add(v.$ref);\n return inlineNonObjectRefs(resolved);\n }\n }\n });\n spec = inlineNonObjectRefs(spec) as Spec;\n\n // Delete the non object schemas that were inlined\n [...inlinedRefs].forEach((ref) => {\n const parts = splitRef(ref);\n if (\n parts.length === 3 &&\n parts[0] === 'components' &&\n parts[1] === 'schemas'\n ) {\n delete spec.components!.schemas![parts[2]];\n }\n });\n\n return spec;\n};\n"],"names":["cloneDeepWith","camelCase","pascalCase","toClassName","upperFirst","STREAMING_CONTENT_TYPES","isRef","resolveIfRef","resolveRef","splitRef","normaliseSchemaNames","spec","schemaNameMapping","originalNames","Object","keys","components","schemas","existingSchemaNames","Set","resolvedNameOwners","forEach","name","normalizedName","has","Error","owner","undefined","length","renamedRef","ref","parts","newName","v","renamed","$ref","Array","isArray","propertyName","mapping","discriminator","fromEntries","entries","map","value","oldName","schema","isCompositeSchema","allOf","anyOf","oneOf","baseMediaType","mediaType","split","trim","preferredJsonMediaType","mediaTypes","find","endsWith","FORM_MEDIA_TYPES","isFormMediaType","includes","isBinaryContentMediaType","contentMediaType","startsWith","markBinaryStringSchema","s","type","format","contentEncoding","items","member","prefixItems","markFormBinaryFields","values","properties","hasSubSchemasToVisit","patternProperties","not","enum","filterInlineCompositeSchemas","nameParts","namePartPrefix","propPath","inlineSchemaIndex","flatMap","i","subSchema","title","createUniqueModelName","seenModelNameCounts","candidateName","join","suffixed","hoistInlineObjectSubSchemas","inlineSubSchemas","filter","additionalProperties","pattern","recursiveRefs","isObjectSchema","refs","structuredClone","schemaWithPropToReplace","slice","reduce","resolvedInSchema","pathPart","nullable","rewriteConstToEnum","rewrite","const","constValue","rest","rewriteCompositeSiblingProperties","required","_type","RESPONSE_CODE_PATTERN","normaliseResponseCodeCase","path","pathItem","paths","method","operation","responses","code","test","toUpperCase","upper","rewriteMultiTypeToAnyOf","nonNull","t","isNullable","inlinePathItemRefs","normaliseOpenApiSpecForCodeGen","inSpec","seenOperationIds","duplicatedOperationIds","writtenOperationIds","Map","pathOps","op","written","operationId","set","String","add","clear","untagged","Symbol","seenOperationIdsByTag","tags","deduplicatedOpId","deduplicatedDotNotationOpId","normalisedTags","tag","tagsAsWritten","idAsWritten","get","at","res","response","jsonMediaType","content","jsonResponseSchema","schemaName","streamingContent","itemSchema","requestBody","contentMediaTypes","bodyMediaType","bodyContentSchema","resolved","parameters","p","param","paramSchema","in","needsName","itemName","inlinedRefs","inlineNonObjectRefs"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,mBAAmB,uBAAuB;AAEjD,SACEC,SAAS,EACTC,UAAU,EACVC,WAAW,EACXC,UAAU,QACL,uBAAuB;AAC9B,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,KAAK,EAAEC,YAAY,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,YAAY;AAetE;;;;CAIC,GACD,MAAMC,uBAAuB,CAACC;IAC5B,MAAMC,oBAAmD,CAAC;IAC1D,MAAMC,gBAAgBC,OAAOC,IAAI,CAACJ,KAAKK,UAAU,EAAEC,WAAW,CAAC;IAC/D,MAAMC,sBAAsB,IAAIC,IAAIN;IAEpC,2EAA2E;IAC3E,0EAA0E;IAC1E,qCAAqC;IACrC,MAAMO,qBAAyD,CAAC;IAEhE,0CAA0C;IAC1CP,cAAcQ,OAAO,CAAC,CAACC;QACrB,MAAMC,iBAAiBpB,YAAYmB;QACnC,IAAIC,mBAAmBD,MAAM;YAC3B,mEAAmE;YACnE,IAAIJ,oBAAoBM,GAAG,CAACD,iBAAiB;gBAC3C,MAAM,IAAIE,MACR,CAAC,qCAAqC,EAAEH,KAAK,0BAA0B,EAAEC,eAAe,gHAAgH,CAAC;YAE7M;YACAX,iBAAiB,CAACU,KAAK,GAAGC;QAC5B;QAEA,yEAAyE;QACzE,mEAAmE;QACnE,kCAAkC;Q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AAK,gBACbA,KAAK,CAAC,EAAE,KAAK,WACb;YACA,OAAOpB,KAAKK,UAAU,CAAEC,OAAO,AAAC,CAACc,KAAK,CAAC,EAAE,CAAC;QAC5C;IACF;IAEA,OAAOpB;AACT,EAAE"}
|
|
@@ -225,7 +225,7 @@ const parseResponseCode = (code)=>/^\d+$/.test(code) ? parseInt(code, 10) : code
|
|
|
225
225
|
// `nullable` beside a `$ref` describes this use of the schema, not the schema
|
|
226
226
|
// itself. OpenAPI 3.0 ignores a `$ref`'s siblings, but normalisation puts it
|
|
227
227
|
// here when it hoists a nullable inline schema — dropping it made a required
|
|
228
|
-
// nullable object property
|
|
228
|
+
// nullable object property reject the null its own spec permits.
|
|
229
229
|
return createModel({
|
|
230
230
|
export: 'reference',
|
|
231
231
|
type: name,
|