@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport orderBy from 'lodash.orderby';\nimport trim from 'lodash.trim';\nimport uniqBy from 'lodash.uniqby';\nimport type { OpenAPIV3 } from 'openapi-types';\nimport {\n camelCase,\n pascalCase,\n snakeCase,\n toClassName,\n upperFirst,\n} from '../../utils/names.js';\nimport {\n toPythonName,\n toPythonType,\n toTypeScriptModelName,\n toTypeScriptName,\n toTypeScriptType,\n} from './codegen-data/languages.js';\nimport {\n COLLECTION_TYPES,\n COMPOSED_SCHEMA_TYPES,\n type CodeGenData,\n type CollectionFormat,\n createModel,\n DEFAULT_SERVICE_NAME,\n indexModelsByName,\n type Model,\n type ModelsByName,\n type Operation,\n type PatternPropertyModel,\n PRIMITIVE_TYPES,\n type Service,\n STREAMING_CONTENT_TYPES,\n VENDOR_EXTENSIONS,\n type VendorExtensions,\n} from './codegen-data/types.js';\nimport { normaliseOpenApiSpecForCodeGen } from './normalise.js';\nimport {\n buildClientData,\n buildInlineModel,\n compositeMemberSchemas,\n getSpecOperation,\n getSpecParametersByKey,\n getSpecPathParameters,\n linkModel,\n specParameterKey,\n} from './parser.js';\nimport { isRef, resolveIfRef, splitRef } from './refs.js';\nimport type { OpenApiSchema, OpenApiSchemaOrRef, Spec } from './types.js';\n\n/**\n * Build the data structure used to generate code from an OpenAPI spec.\n */\nexport const buildOpenApiCodeGenData = (inSpec: Spec): CodeGenData => {\n const spec = normaliseOpenApiSpecForCodeGen(inSpec);\n const data = buildClientData(spec);\n\n const modelsByName = indexModelsByName(data.models);\n\n for (const service of data.services) {\n augmentService(spec, service, modelsByName);\n }\n\n const allOperations = uniqBy(\n data.services.flatMap((s) => s.operations),\n (o) => o.uniqueName,\n );\n\n // A model per operation request parameter position (query/path/body/...).\n data.models = [\n ...data.models,\n ...allOperations.flatMap((op) =>\n buildRequestParameterModels(op, modelsByName),\n ),\n ];\n\n for (const model of data.models) {\n augmentModel(spec, model, modelsByName);\n }\n for (const model of data.models) {\n model.typescriptName = toTypeScriptModelName(model.name);\n model.typescriptType = model.typescriptName;\n }\n\n for (const model of data.models) {\n assertNoClashingPropertyNames(model);\n assertNoConflictingUnionMemberMarshalling(model, modelsByName);\n }\n\n for (const op of allOperations) {\n assertEncodableUrlEncodedBody(op);\n }\n\n data.models = orderBy(data.models, (d) => d.name);\n // Default service first, then by name.\n data.services = orderBy(data.services, (s) =>\n s.name === DEFAULT_SERVICE_NAME ? '' : s.name,\n );\n\n const { operationsByTag, untaggedOperations } =\n groupOperationsByTag(allOperations);\n\n return {\n ...data,\n operationsByTag,\n untaggedOperations,\n info: spec.info,\n allOperations,\n vendorExtensions: vendorExtensionsOf(spec),\n className: toClassName(spec.info.title),\n };\n};\n\n/**\n * Augment a service and each of its operations with the data needed for code\n * generation (names, imports, result/request types, behavioural flags), and\n * compute the set of models the service (ie API client) needs to import.\n */\nconst augmentService = (\n spec: Spec,\n service: Service,\n modelsByName: ModelsByName,\n): void => {\n const modelImports = service.operations.flatMap((op) =>\n augmentOperation(spec, op, modelsByName),\n );\n\n service.operations = orderBy(service.operations, (op) => op.uniqueName);\n service.modelImports = orderBy(\n uniqBy([...service.imports, ...modelImports], (x) => x),\n );\n service.className = `${service.name}Api`;\n service.nameSnakeCase = snakeCase(service.name);\n};\n\n/**\n * Augment a single operation with all the data the templates need, returning\n * the names of the models it references (for the service's import list).\n */\nconst augmentOperation = (\n spec: Spec,\n op: Operation,\n modelsByName: ModelsByName,\n): string[] => {\n const specOp = getSpecOperation(spec, op);\n\n assignOperationNames(op, specOp);\n\n op.vendorExtensions = vendorExtensionsOf(specOp);\n\n const modelImports = [\n ...(specOp ? augmentResponses(spec, op, specOp, modelsByName) : []),\n ...augmentParameters(spec, op, specOp, modelsByName),\n ];\n\n op.responses.forEach(addLanguageTypes);\n op.responses = orderBy(op.responses, (r) => r.code);\n\n // Result is the lowest successful response, otherwise the 2XX or default.\n op.result =\n op.responses.find(\n (r) => typeof r.code === 'number' && r.code >= 200 && r.code < 300,\n ) ?? op.responses.find((r) => r.code === '2XX' || r.code === 'default');\n\n op.operationIdPascalCase = pascalCase(op.uniqueName);\n op.operationIdSnakeCase = toPythonName('operation', op.uniqueName);\n\n if (op.parameters.length > 0) {\n const baseRequestTypeName = `${op.operationIdPascalCase}Request`;\n // Use the OperationRequest suffix when the standard Request name clashes\n // with an existing schema.\n op.requestTypeName = spec.components?.schemas?.[baseRequestTypeName]\n ? `${op.operationIdPascalCase}OperationRequest`\n : baseRequestTypeName;\n }\n\n augmentOperationBehaviour(op);\n\n return modelImports;\n};\n\n/**\n * Set an operation's name and its deduplicated variants from the vendor\n * extensions the normaliser added.\n */\nconst assignOperationNames = (\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n): void => {\n const deduplicatedOpId = specOp?.['x-aws-nx-deduplicated-op-id'] as\n | string\n | undefined;\n const dotNotationOpId = specOp?.['x-aws-nx-deduplicated-dot-op-id'] as\n | string\n | undefined;\n\n op.name = op.id ?? op.name;\n op.uniqueName = deduplicatedOpId ?? op.name;\n if (dotNotationOpId) {\n op.dotNotationName = dotNotationOpId;\n }\n};\n\n/**\n * Augment an operation's response models with schema-derived data, resolving\n * void responses and streaming item schemas. Returns the response model names\n * to import.\n */\nconst augmentResponses = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject,\n modelsByName: ModelsByName,\n): string[] => {\n const modelImports = op.responses\n .filter((r) => r.export === 'reference')\n .map((r) => r.type);\n\n for (const response of op.responses) {\n // We cannot distinguish a composite of primitives at runtime (it all comes\n // back as text), so validate this away.\n if (\n response.export === 'reference' &&\n COMPOSED_SCHEMA_TYPES.has(modelsByName[response.type]?.export)\n ) {\n const composedPrimitives = (\n modelsByName[response.type].composedPrimitives ?? []\n ).filter((p) => !COLLECTION_TYPES.has(p.export));\n if (composedPrimitives.length > 0) {\n throw new Error(\n `Operation \"${op.method} ${op.path}\" returns a composite schema of primitives with ${camelCase(modelsByName[response.type].export)}, which cannot be distinguished at runtime`,\n );\n }\n }\n\n const matchingSpecResponse = specOp.responses[`${response.code}`];\n if (!matchingSpecResponse) continue;\n\n const specResponse = resolveIfRef(spec, matchingSpecResponse);\n\n // When there's no content, the response type is 'void'\n if (!specResponse.content) {\n response.type = 'void';\n continue;\n }\n\n const mediaTypes = Object.keys(specResponse.content);\n response.mediaTypes = mediaTypes;\n\n for (const mediaType of mediaTypes) {\n const responseContent = specResponse.content[mediaType];\n const responseSchema = resolveIfRef(spec, responseContent.schema);\n if (responseSchema) {\n augmentModelFromSchema(spec, response, responseSchema, modelsByName);\n }\n if (\n STREAMING_CONTENT_TYPES.has(mediaType) &&\n 'itemSchema' in responseContent\n ) {\n response.isJsonlStreaming = true;\n response.itemSchemaModel = buildOrReferenceModel(\n spec,\n modelsByName,\n responseContent.itemSchema as OpenApiSchemaOrRef,\n );\n }\n }\n }\n\n return modelImports;\n};\n\n/**\n * Augment an operation's parameter models with schema-derived data, resolving\n * request bodies and query/header collection formats. Returns the parameter\n * model names to import.\n */\nconst augmentParameters = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): string[] => {\n const specParametersByKey = getSpecParametersByKey(\n spec,\n specOp,\n getSpecPathParameters(spec, op),\n );\n\n const modelImports: string[] = [];\n\n for (const parameter of op.parameters) {\n if (parameter.export === 'reference') {\n modelImports.push(parameter.type);\n }\n\n const specParameter =\n specParametersByKey[\n specParameterKey({ in: parameter.in, name: parameter.prop })\n ];\n const specParameterSchema = resolveIfRef(spec, specParameter?.schema);\n if (specParameterSchema) {\n augmentModelFromSchema(\n spec,\n parameter,\n specParameterSchema,\n modelsByName,\n );\n }\n\n if (parameter.in === 'body') {\n augmentBodyParameter(spec, parameter, specOp, modelsByName);\n } else if (\n (parameter.in === 'query' || parameter.in === 'header') &&\n specParameter\n ) {\n parameter.collectionFormat = getCollectionFormat(\n parameter.in,\n specParameter,\n );\n if (parameter.in === 'query' && specParameter.allowReserved) {\n parameter.allowReserved = true;\n }\n } else if (parameter.in === 'path' && specParameter) {\n const style = specParameter.style;\n if (style === 'matrix' || style === 'label') {\n parameter.pathStyle = style;\n parameter.pathExplode = !!specParameter.explode;\n }\n }\n\n addLanguageTypes(parameter);\n }\n\n return modelImports;\n};\n\n/**\n * Augment a request body parameter with its schema (the body is not in the\n * spec's `parameters`, so it is resolved from `requestBody` here) and record\n * its acceptable media types.\n */\nconst augmentBodyParameter = (\n spec: Spec,\n parameter: Model,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): void => {\n // The request body parameter is named 'body' downstream.\n parameter.name = 'body';\n parameter.prop = 'body';\n\n const specBody = resolveIfRef(spec, specOp?.requestBody);\n if (!specBody) return;\n\n if (parameter.mediaType) {\n const bodySchema = resolveIfRef(\n spec,\n specBody.content?.[parameter.mediaType]?.schema,\n );\n if (bodySchema) {\n augmentModelFromSchema(spec, parameter, bodySchema, modelsByName);\n }\n }\n // Track all the media types that can be accepted in the request body\n parameter.mediaTypes = Object.keys(specBody.content);\n};\n\n/**\n * Translate an OpenAPI v3 parameter's style/explode into a v2-style\n * collectionFormat used when serialising array parameters.\n * @see https://spec.openapis.org/oas/v3.0.3.html#style-values\n */\nconst getCollectionFormat = (\n position: 'query' | 'header',\n specParameter: OpenAPIV3.ParameterObject,\n): CollectionFormat => {\n const style =\n specParameter.style ?? (position === 'query' ? 'form' : 'simple');\n const explode = specParameter.explode ?? style === 'form';\n\n if (position === 'header') {\n return explode ? 'multi' : 'csv';\n }\n // `deepObject` serialises an object as `key[prop]=value` pairs regardless of\n // explode; the object shape (not array collection) drives its serialisation.\n if (style === 'deepObject') {\n return 'deepObject';\n }\n return explode\n ? 'multi'\n : ((\n {\n spaceDelimited: 'ssv',\n pipeDelimited: 'pipes',\n simple: 'csv',\n form: 'csv',\n } as const\n )[style] ?? 'multi');\n};\n\n/**\n * Build the request parameter models for an operation — one model per parameter\n * position (query/path/header/cookie/body), named e.g.\n * `FooRequestQueryParameters`. Request bodies that can be represented directly\n * (the sole parameter, or a non-clashing object reference) are inlined rather\n * than given a wrapper model, and recorded on `op.explicitRequestBodyParameter`.\n */\nconst buildRequestParameterModels = (\n op: Operation,\n modelsByName: ModelsByName,\n): Model[] => {\n if (!op.parameters || op.parameters.length === 0) {\n return [];\n }\n\n // Whether the request body can be represented directly, without a wrapper\n // model (ie the request will be the body itself).\n const canInlineBody = (body: Model): boolean => {\n // If the body is the only parameter, we can inline it no matter the type\n if (op.parameters.length === 1) {\n return true;\n }\n // We inline object bodies, so long as they aren't dictionaries (as\n // dictionary keys could clash with other parameters), and so long as they\n // don't have a property name that clashes with another parameter\n const hasClashingPropertyName = (\n modelsByName?.[body.type]?.properties ?? []\n ).some((prop) => op.parameters.some((param) => param.name === prop.name));\n return (\n body.export === 'reference' &&\n modelsByName?.[body.type]?.export !== 'dictionary' &&\n !hasClashingPropertyName\n );\n };\n\n // Group parameters by their position (`in`: query/path/header/cookie/body),\n // dropping any body that can be inlined.\n const parametersByPosition = op.parameters\n .filter((p) => !(p.in === 'body' && canInlineBody(p)))\n .reduce<{ [position: string]: Model[] }>(\n (acc, p) => ({ ...acc, [p.in]: [...(acc[p.in] ?? []), p] }),\n {},\n );\n\n // The body parameter was already renamed to \"body\" by augmentBodyParameter.\n op.explicitRequestBodyParameter = parametersByPosition['body']?.[0];\n\n return Object.entries(parametersByPosition).map(([position, parameters]) => {\n const name = `${op.operationIdPascalCase}Request${upperFirst(position)}Parameters`;\n return createModel({\n description: op.description,\n export: 'interface',\n name,\n properties: parameters,\n type: name,\n isRequired: true,\n });\n });\n};\n\n/**\n * Augment a single model with schema-derived data (from its matching spec\n * schema, if any) and language-specific names and types.\n */\nconst augmentModel = (\n spec: Spec,\n model: Model,\n modelsByName: ModelsByName,\n): void => {\n model.nameSnakeCase = toPythonName('model', model.name);\n\n const matchingSpecModel = spec?.components?.schemas?.[model.name];\n if (matchingSpecModel) {\n const specModel = resolveIfRef(spec, matchingSpecModel);\n\n augmentModelFromSchema(spec, model, specModel, modelsByName);\n\n for (const property of model.properties) {\n const matchingSpecProperty = specModel.properties?.[property.name];\n if (matchingSpecProperty) {\n const specProperty = resolveIfRef(spec, matchingSpecProperty);\n augmentModelFromSchema(spec, property, specProperty, modelsByName);\n }\n }\n }\n\n model.properties.forEach(addLanguageTypes);\n\n // Resolve the discriminator's TypeScript property name for marshalling.\n if (model.discriminator) {\n model.discriminator.typescriptPropertyName = toTypeScriptName(\n model.discriminator.propertyName,\n );\n }\n};\n\n/**\n * Ensure no two properties/parameters of an object model collapse onto the same\n * TypeScript identifier (e.g. `foo-bar` and `foo_bar` both camelCase to\n * `fooBar`, or a query and header parameter sharing a name within one request\n * position). Such a clash would emit a type with duplicate members that does\n * not compile, so fail fast with an actionable error instead.\n */\nconst assertNoClashingPropertyNames = (model: Model): void => {\n const seen = new Map<string, string>();\n for (const property of model.properties) {\n // Composite members are unnamed (their names are empty); skip them.\n if (!property.name) continue;\n const existing = seen.get(property.typescriptName!);\n if (existing !== undefined && existing !== property.name) {\n throw new Error(\n `Property name conflict in \"${model.name}\": \"${existing}\" and \"${property.name}\" both map to the TypeScript name \"${property.typescriptName}\". Please rename one of these in your OpenAPI specification.`,\n );\n }\n seen.set(property.typescriptName!, property.name);\n }\n};\n\n/**\n * The marshalling semantics of a property — two properties with the same key\n * convert identically on the wire (so either branch's conversion is safe).\n */\nconst marshallingKey = (\n m: Model,\n modelsByName: ModelsByName,\n visiting: Set<string> = new Set(),\n): string => {\n if (['date', 'date-time'].includes(m.format ?? '')) return 'date';\n if (m.type === 'binary') return 'binary';\n // Enums serialise as their bare primitive (no conversion).\n if (m.isEnum || m.export === 'enum') return 'plain';\n if (COLLECTION_TYPES.has(m.export)) {\n return `${m.export}<${m.link ? marshallingKey(m.link, modelsByName, visiting) : 'plain'}>`;\n }\n if (m.export === 'tuple') {\n return `tuple<${m.properties.map((p) => marshallingKey(p, modelsByName, visiting)).join(',')}>`;\n }\n if (m.export === 'reference' && !PRIMITIVE_TYPES.has(m.type)) {\n // Key on what the reference marshals to, not what it is called. The\n // normaliser hoists each inline schema to its own name, so two members\n // declaring an identical property get different names — keying on the name\n // alone rejected unions whose members convert identically.\n const referenced = modelsByName[m.type];\n if (!referenced || visiting.has(m.type)) return `ref:${m.type}`;\n const nested = new Set(visiting).add(m.type);\n if (referenced.export === 'one-of' || referenced.export === 'any-of') {\n const members = [\n ...(referenced.composedModels ?? []),\n ...(referenced.composedPrimitives ?? []),\n ]\n .map((member) => marshallingKey(member, modelsByName, nested))\n .sort();\n return `union<${[...new Set(members)].join('|')}>`;\n }\n if (referenced.export === 'interface') {\n // Keyed on the shape too, for the same reason: two members declaring an\n // identical inline object property are hoisted to different names.\n const fields = (referenced.properties ?? [])\n .filter((property) => property.name)\n .map(\n (property) =>\n `${property.name}:${property.isRequired ? '!' : '?'}${marshallingKey(property, modelsByName, nested)}`,\n )\n .sort();\n return `object<${fields.join(',')}>`;\n }\n // An `all-of` composes members that are resolved later, so it keeps its name\n // as its key rather than a shape this pass cannot see yet.\n if (referenced.export === 'all-of') return `ref:${m.type}`;\n return marshallingKey(referenced, modelsByName, nested);\n }\n return 'plain';\n};\n\n/**\n * A non-discriminated `oneOf`/`anyOf` of object members marshals by composing\n * every member, taking only the properties present on the value. That is sound\n * exactly when no wire property is claimed by two members with different\n * marshalling (e.g. a `date-time` in one and a plain string in another) —\n * otherwise the branch cannot be determined without guessing, so fail fast and\n * ask for a discriminator rather than corrupt data at runtime.\n */\nconst assertNoConflictingUnionMemberMarshalling = (\n model: Model,\n modelsByName: ModelsByName,\n): void => {\n if (\n (model.export !== 'one-of' && model.export !== 'any-of') ||\n model.discriminator\n ) {\n return;\n }\n const seen = new Map<string, { memberName: string; key: string }>();\n for (const member of model.composedModels ?? []) {\n for (const property of member.properties) {\n if (!property.name) continue;\n const key = marshallingKey(property, modelsByName);\n const existing = seen.get(property.name);\n if (existing && existing.key !== key) {\n throw new Error(\n `Schema \"${model.name}\" is a non-discriminated ${camelCase(model.export)} of \"${existing.memberName}\" and \"${member.name}\", which both declare a property \"${property.name}\" with different types, so the correct conversion cannot be determined. Add a discriminator to the union in your OpenAPI specification (e.g. with Pydantic, Field(discriminator=...)).`,\n );\n }\n if (!existing) {\n seen.set(property.name, { memberName: member.name, key });\n }\n }\n }\n};\n\n/**\n * An `application/x-www-form-urlencoded` body is form-encoded as `key=value`\n * pairs, so the wire form is only defined for a schema with named properties\n * (an object) or a primitive sent verbatim. A top-level array or tuple has no\n * property names to key on — encoding it would emit index keys (`0=a&1=b`) that\n * no form parser can decode — so fail fast rather than generate a client that\n * is silently wrong on the wire.\n */\nconst assertEncodableUrlEncodedBody = (op: Operation): void => {\n const body = op.parametersBody;\n if (!body?.mediaTypes) return;\n const mediaTypes = Array.isArray(body.mediaTypes)\n ? body.mediaTypes\n : [body.mediaTypes];\n // Match the wire media type the client actually sends: JSON is preferred, so\n // an array body offering both JSON and urlencoded is sent as JSON and is fine.\n const chosenMediaType =\n mediaTypes.find(\n (mt) => mt === 'application/json' || mt.endsWith('+json'),\n ) ?? mediaTypes[0];\n if (chosenMediaType !== 'application/x-www-form-urlencoded') return;\n if (body.isPrimitive) return;\n if (body.export === 'array' || body.export === 'tuple') {\n throw new Error(\n `Operation ${op.method} ${op.path} has an application/x-www-form-urlencoded request body whose schema is a ${body.export}, which has no defined form encoding. Use an object schema (its properties become the form fields) or a primitive schema (sent verbatim) in your OpenAPI specification.`,\n );\n }\n};\n\n/**\n * Group operations by their (camelCased) tags, collecting any untagged\n * operations separately.\n */\nconst groupOperationsByTag = (\n allOperations: Operation[],\n): {\n operationsByTag: { [tag: string]: Operation[] };\n untaggedOperations: Operation[];\n} => {\n const isTagged = (op: Operation): boolean => !!op.tags && op.tags.length > 0;\n\n const operationsByTag = allOperations\n .filter(isTagged)\n .flatMap((op) => op.tags!.map((tag) => [camelCase(tag), op] as const))\n .reduce<{ [tag: string]: Operation[] }>(\n (acc, [tag, op]) => ({ ...acc, [tag]: [...(acc[tag] ?? []), op] }),\n {},\n );\n\n return {\n operationsByTag,\n untaggedOperations: allOperations.filter((op) => !isTagged(op)),\n };\n};\n\n/**\n * Resolve a schema to its model: an existing named model for a `$ref`, or a\n * freshly built-and-augmented model for an inline (nested value) schema.\n */\nconst buildOrReferenceModel = (\n spec: Spec,\n modelsByName: ModelsByName,\n schema: OpenApiSchemaOrRef,\n): Model => {\n if (isRef(schema)) {\n const name = splitRef(schema.$ref)[2];\n return modelsByName[name];\n }\n const model = buildInlineModel(spec, schema);\n linkModel(spec, modelsByName, model, schema);\n augmentModelFromSchema(spec, model, schema, modelsByName);\n return model;\n};\n\n/**\n * The `x-*` vendor extensions declared on an object.\n */\nconst vendorExtensionsOf = (object: object | undefined): VendorExtensions =>\n Object.fromEntries(\n Object.entries(object ?? {}).filter(([key]) => key.startsWith('x-')),\n );\n\nconst augmentModelFromSchema = (\n spec: Spec,\n model: Model,\n schema: OpenApiSchema,\n modelsByName: ModelsByName,\n visited: Set<Model> = new Set(),\n) => {\n model.format = schema.format;\n model.deprecated = !!schema.deprecated;\n model.openapiType = schema.type;\n model.isEnum = !!schema.enum && schema.enum.length > 0;\n model.vendorExtensions = vendorExtensionsOf(schema);\n\n // A \"dictionary\" has only additional properties; an \"interface\" may mix\n // explicit and additional properties.\n if (schema.additionalProperties) {\n const additionalPropertiesModel = buildOrReferenceModel(\n spec,\n modelsByName,\n schema.additionalProperties === true ? {} : schema.additionalProperties,\n );\n\n if (model.export === 'dictionary') {\n // A dictionary carries a self-referential property; the rest are explicit\n const explicitProperties = model.properties.filter(\n (p) => !(p.export === 'dictionary' && p.name === model.name),\n );\n\n // Explicit properties make this an interface rather than a dictionary\n if (explicitProperties.length > 0 || schema.patternProperties) {\n model.export = 'interface';\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n model.properties = explicitProperties;\n }\n } else {\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n }\n }\n\n // Pattern properties can have different value types per pattern, so the model\n // is an interface rather than a dictionary.\n if (schema.patternProperties) {\n const patternProperties = resolveIfRef(spec, schema.patternProperties);\n\n if (model.export === 'dictionary') {\n model.export = 'interface';\n }\n\n model.hasPatternProperties = true;\n model.patternPropertiesModels = Object.entries(patternProperties)\n .map(([pattern, patternProperty]) => ({\n pattern,\n model: buildOrReferenceModel(spec, modelsByName, patternProperty),\n }))\n .filter((entry): entry is PatternPropertyModel => !!entry.model);\n }\n\n addLanguageTypes(model);\n\n visited.add(model);\n\n const recurse = (target: Model, subSchema: OpenApiSchema): void =>\n augmentModelFromSchema(spec, target, subSchema, modelsByName, visited);\n\n // Array element type.\n if (\n model.export === 'array' &&\n model.link &&\n 'items' in schema &&\n schema.items &&\n !visited.has(model.link)\n ) {\n recurse(model.link, resolveIfRef(spec, schema.items));\n }\n\n // Dictionary value type (additionalProperties may be `true` rather than a\n // schema).\n if (\n model.export === 'dictionary' &&\n model.link &&\n 'additionalProperties' in schema &&\n schema.additionalProperties &&\n !visited.has(model.link)\n ) {\n const subSchema = resolveIfRef(spec, schema.additionalProperties);\n if (subSchema !== true) {\n recurse(model.link, subSchema);\n }\n }\n\n // Tuple element types (3.1 `prefixItems`), positionally.\n if (model.export === 'tuple' && 'prefixItems' in schema) {\n const memberSchemas =\n (schema as { prefixItems?: OpenApiSchemaOrRef[] }).prefixItems ?? [];\n model.properties.forEach((member, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema && !visited.has(member)) {\n recurse(member, subSchema);\n }\n });\n }\n\n model.properties\n .filter((p) => !visited.has(p) && schema.properties?.[trim(p.name, `\"'`)])\n .forEach((property) =>\n recurse(\n property,\n resolveIfRef(spec, schema.properties![trim(property.name, `\"'`)]),\n ),\n );\n\n if (COMPOSED_SCHEMA_TYPES.has(model.export)) {\n const memberSchemas = compositeMemberSchemas(schema, model.export);\n model.properties.forEach((property, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema) {\n recurse(property, subSchema);\n }\n });\n }\n};\n\nconst addLanguageTypes = (model: Model) => {\n model.name = trim(model.name, `\"'`);\n model.typescriptName = toTypeScriptName(model.name);\n model.typescriptType = toTypeScriptType(model);\n model.pythonName = toPythonName('property', model.name);\n model.pythonType = toPythonType(model);\n model.isPrimitive =\n PRIMITIVE_TYPES.has(model.type) &&\n !COMPOSED_SCHEMA_TYPES.has(model.export) &&\n !COLLECTION_TYPES.has(model.export);\n};\n\nconst isOperationMutation = (op: Operation): boolean => {\n // x-mutation/x-query override the HTTP-method default.\n const { vendorExtensions } = op;\n if (vendorExtensions?.[VENDOR_EXTENSIONS.MUTATION]) {\n return true;\n } else if (vendorExtensions?.[VENDOR_EXTENSIONS.QUERY]) {\n return false;\n }\n return ['PATCH', 'POST', 'PUT', 'DELETE'].includes(op.method);\n};\n\nconst augmentInfiniteQuery = (op: Operation) => {\n const { paginationDisabled, cursorPropertyName } = getCursorOptions(op);\n\n const cursorProperty = op.parameters.find(\n (p) => p.name === cursorPropertyName,\n );\n\n // An infinite query is a paginated operation that accepts the cursor parameter\n op.isInfiniteQuery = !paginationDisabled && !!cursorProperty;\n if (op.isInfiniteQuery) {\n op.infiniteQueryCursorProperty = cursorProperty;\n }\n};\n\n/**\n * Resolve the pagination cursor options from an operation's `x-cursor` vendor\n * extension. Accepted forms (object variants exist because Smithy vendor\n * extensions must be objects):\n *\n * - `'property'` / `{ inputToken: 'property' }` — the input property to page on\n * - `false` / `{ enabled: false }` — disable pagination\n */\nconst getCursorOptions = (\n op: Operation,\n): { paginationDisabled: boolean; cursorPropertyName: string } => {\n const cursor = op.vendorExtensions?.[VENDOR_EXTENSIONS.CURSOR];\n\n // Defaults: pagination enabled, paging on a property named 'cursor'.\n if (cursor === false) {\n return { paginationDisabled: true, cursorPropertyName: 'cursor' };\n }\n if (typeof cursor === 'string') {\n return { paginationDisabled: false, cursorPropertyName: cursor };\n }\n const options = (cursor ?? {}) as { enabled?: boolean; inputToken?: unknown };\n return {\n paginationDisabled: options.enabled === false,\n cursorPropertyName:\n typeof options.inputToken === 'string' ? options.inputToken : 'cursor',\n };\n};\n\n/**\n * Add query/mutation, streaming and infinite-query flags to an operation.\n */\nconst augmentOperationBehaviour = (op: Operation) => {\n const isMutation = isOperationMutation(op);\n op.isMutation = isMutation;\n op.isQuery = !isMutation;\n\n op.isStreaming =\n !!op.vendorExtensions?.[VENDOR_EXTENSIONS.STREAMING] ||\n op.responses.some((res) => res.isJsonlStreaming);\n\n // For JSON-lines streaming, the result is each streamed item, so the client\n // method returns AsyncIterableIterator<itemSchemaModel>. Named (hoisted)\n // item schemas become references; inline primitives keep their own type.\n const jsonlResponse = op.responses.find((res) => res.isJsonlStreaming);\n if (jsonlResponse) {\n const itemSchemaModel = jsonlResponse.itemSchemaModel;\n const result = op.result;\n if (result && itemSchemaModel) {\n if (itemSchemaModel.name) {\n result.type = itemSchemaModel.name;\n result.typescriptType = itemSchemaModel.name;\n result.export = 'reference';\n } else {\n result.type = itemSchemaModel.type;\n result.typescriptType = itemSchemaModel.typescriptType;\n result.export = itemSchemaModel.export;\n result.format = itemSchemaModel.format;\n result.link = itemSchemaModel.link;\n result.isPrimitive = itemSchemaModel.isPrimitive;\n }\n }\n }\n\n // Add infinite query details if applicable\n if (!isMutation) {\n augmentInfiniteQuery(op);\n }\n};\n"],"names":["orderBy","trim","uniqBy","camelCase","pascalCase","snakeCase","toClassName","upperFirst","toPythonName","toPythonType","toTypeScriptModelName","toTypeScriptName","toTypeScriptType","COLLECTION_TYPES","COMPOSED_SCHEMA_TYPES","createModel","DEFAULT_SERVICE_NAME","indexModelsByName","PRIMITIVE_TYPES","STREAMING_CONTENT_TYPES","VENDOR_EXTENSIONS","normaliseOpenApiSpecForCodeGen","buildClientData","buildInlineModel","compositeMemberSchemas","getSpecOperation","getSpecParametersByKey","getSpecPathParameters","linkModel","specParameterKey","isRef","resolveIfRef","splitRef","buildOpenApiCodeGenData","inSpec","spec","data","modelsByName","models","service","services","augmentService","allOperations","flatMap","s","operations","o","uniqueName","op","buildRequestParameterModels","model","augmentModel","typescriptName","name","typescriptType","assertNoClashingPropertyNames","assertNoConflictingUnionMemberMarshalling","assertEncodableUrlEncodedBody","d","operationsByTag","untaggedOperations","groupOperationsByTag","info","vendorExtensions","vendorExtensionsOf","className","title","modelImports","augmentOperation","imports","x","nameSnakeCase","specOp","assignOperationNames","augmentResponses","augmentParameters","responses","forEach","addLanguageTypes","r","code","result","find","operationIdPascalCase","operationIdSnakeCase","parameters","length","baseRequestTypeName","requestTypeName","components","schemas","augmentOperationBehaviour","deduplicatedOpId","dotNotationOpId","id","dotNotationName","filter","export","map","type","response","has","composedPrimitives","p","Error","method","path","matchingSpecResponse","specResponse","content","mediaTypes","Object","keys","mediaType","responseContent","responseSchema","schema","augmentModelFromSchema","isJsonlStreaming","itemSchemaModel","buildOrReferenceModel","itemSchema","specParametersByKey","parameter","push","specParameter","in","prop","specParameterSchema","augmentBodyParameter","collectionFormat","getCollectionFormat","allowReserved","style","pathStyle","pathExplode","explode","specBody","requestBody","bodySchema","position","spaceDelimited","pipeDelimited","simple","form","canInlineBody","body","hasClashingPropertyName","properties","some","param","parametersByPosition","reduce","acc","explicitRequestBodyParameter","entries","description","isRequired","matchingSpecModel","specModel","property","matchingSpecProperty","specProperty","discriminator","typescriptPropertyName","propertyName","seen","Map","existing","get","undefined","set","marshallingKey","m","visiting","Set","includes","format","isEnum","link","join","referenced","nested","add","members","composedModels","member","sort","fields","key","memberName","parametersBody","Array","isArray","chosenMediaType","mt","endsWith","isPrimitive","isTagged","tags","tag","$ref","object","fromEntries","startsWith","visited","deprecated","openapiType","enum","additionalProperties","additionalPropertiesModel","explicitProperties","patternProperties","hasAdditionalProperties","hasPatternProperties","patternPropertiesModels","pattern","patternProperty","entry","recurse","target","subSchema","items","memberSchemas","prefixItems","i","pythonName","pythonType","isOperationMutation","MUTATION","QUERY","augmentInfiniteQuery","paginationDisabled","cursorPropertyName","getCursorOptions","cursorProperty","isInfiniteQuery","infiniteQueryCursorProperty","cursor","CURSOR","options","enabled","inputToken","isMutation","isQuery","isStreaming","STREAMING","res","jsonlResponse"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,aAAa,iBAAiB;AACrC,OAAOC,UAAU,cAAc;AAC/B,OAAOC,YAAY,gBAAgB;AAEnC,SACEC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,WAAW,EACXC,UAAU,QACL,uBAAuB;AAC9B,SACEC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,gBAAgB,EAChBC,gBAAgB,QACX,8BAA8B;AACrC,SACEC,gBAAgB,EAChBC,qBAAqB,EAGrBC,WAAW,EACXC,oBAAoB,EACpBC,iBAAiB,EAKjBC,eAAe,EAEfC,uBAAuB,EACvBC,iBAAiB,QAEZ,0BAA0B;AACjC,SAASC,8BAA8B,QAAQ,iBAAiB;AAChE,SACEC,eAAe,EACfC,gBAAgB,EAChBC,sBAAsB,EACtBC,gBAAgB,EAChBC,sBAAsB,EACtBC,qBAAqB,EACrBC,SAAS,EACTC,gBAAgB,QACX,cAAc;AACrB,SAASC,KAAK,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,YAAY;AAG1D;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtC,MAAMC,OA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AAGoB,gBAAgBpB,IAAI;gBAClClB,OAAO3B,cAAc,GAAGiE,gBAAgBjE,cAAc;gBACtD2B,OAAOgB,MAAM,GAAGsB,gBAAgBtB,MAAM;gBACtChB,OAAOgG,MAAM,GAAG1D,gBAAgB0D,MAAM;gBACtChG,OAAOkG,IAAI,GAAG5D,gBAAgB4D,IAAI;gBAClClG,OAAOoH,WAAW,GAAG9E,gBAAgB8E,WAAW;YAClD;QACF;IACF;IAEA,2CAA2C;IAC3C,IAAI,CAAC8C,YAAY;QACfZ,qBAAqBvL;IACvB;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { createHash } from 'node:crypto';\nimport orderBy from 'lodash.orderby';\nimport trim from 'lodash.trim';\nimport uniqBy from 'lodash.uniqby';\nimport type { OpenAPIV3 } from 'openapi-types';\nimport {\n camelCase,\n pascalCase,\n snakeCase,\n toClassName,\n upperFirst,\n} from '../../utils/names.js';\nimport {\n qualifyPythonType,\n toPythonAnnotation,\n toPythonClassName,\n toPythonName,\n toPythonType,\n toPythonTypeTree,\n toTypeScriptModelName,\n toTypeScriptName,\n toTypeScriptType,\n} from './codegen-data/languages.js';\nimport {\n COLLECTION_TYPES,\n COMPOSED_SCHEMA_TYPES,\n type CodeGenData,\n type CollectionFormat,\n createModel,\n DEFAULT_SERVICE_NAME,\n type ErrorShape,\n indexModelsByName,\n type Model,\n type ModelsByName,\n type Operation,\n type PatternPropertyModel,\n PRIMITIVE_TYPES,\n type PythonType,\n type RequestInput,\n type RequestShape,\n type Service,\n STREAMING_CONTENT_TYPES,\n VENDOR_EXTENSIONS,\n type VendorExtensions,\n} from './codegen-data/types.js';\nimport { normaliseOpenApiSpecForCodeGen } from './normalise.js';\nimport {\n buildClientData,\n buildInlineModel,\n compositeMemberSchemas,\n getSpecOperation,\n getSpecParametersByKey,\n getSpecPathParameters,\n linkModel,\n specParameterKey,\n} from './parser.js';\nimport { isRef, resolveIfRef, splitRef } from './refs.js';\nimport type { OpenApiSchema, OpenApiSchemaOrRef, Spec } from './types.js';\n\n/**\n * Build the data structure used to generate code from an OpenAPI spec.\n */\nexport const buildOpenApiCodeGenData = (inSpec: Spec): CodeGenData => {\n const spec = normaliseOpenApiSpecForCodeGen(inSpec);\n const data = buildClientData(spec);\n\n const modelsByName = indexModelsByName(data.models);\n\n for (const service of data.services) {\n augmentService(spec, service, modelsByName);\n }\n\n const allOperations = uniqBy(\n data.services.flatMap((s) => s.operations),\n (o) => o.uniqueName,\n );\n\n // A model per operation request parameter position (query/path/body/...).\n // Named against the schemas already declared, since a spec may declare one\n // called `FooRequestQueryParameters` itself — emitting that name twice made the\n // second definition win and silently retyped every reference to the first.\n const takenModelNames = new Set(data.models.map((model) => model.name));\n data.models = [\n ...data.models,\n ...allOperations.flatMap((op) =>\n buildRequestParameterModels(op, modelsByName, takenModelNames),\n ),\n ];\n\n for (const model of data.models) {\n augmentModel(spec, model, modelsByName);\n }\n for (const model of data.models) {\n model.typescriptName = toTypeScriptModelName(model.name);\n model.typescriptType = model.typescriptName;\n }\n\n for (const model of data.models) {\n assertNoClashingPropertyNames(model);\n assertNoConflictingUnionMemberMarshalling(model, modelsByName);\n }\n\n for (const op of allOperations) {\n assertEncodableUrlEncodedBody(op);\n }\n\n data.models = orderBy(data.models, (d) => d.name);\n // Default service first, then by name.\n data.services = orderBy(data.services, (s) =>\n s.name === DEFAULT_SERVICE_NAME ? '' : s.name,\n );\n\n const { operationsByTag, untaggedOperations } =\n groupOperationsByTag(allOperations);\n\n annotateAllOfFlattening(data.models);\n for (const op of allOperations) {\n annotateRequestAndErrorShapes(op, modelsByName);\n }\n\n const result: CodeGenData = {\n ...data,\n operationsByTag,\n untaggedOperations,\n info: spec.info,\n allOperations,\n vendorExtensions: vendorExtensionsOf(spec),\n className: toClassName(spec.info.title),\n };\n\n return result;\n};\n\n/**\n * For each `all-of` composite: precompute the flat property list templates\n * that flatten composition will emit (`effectiveProperties`), and mark\n * hoisted (normaliser-synthesised) components the parent inlines\n * (`isInlinedByAllOf`) so templates can skip emitting them separately.\n */\nconst annotateAllOfFlattening = (models: Model[]): void => {\n /**\n * Collect a composed model's own properties, recursing through a member that\n * is itself an `all-of` so a nested composition contributes the leaf\n * properties rather than the composite itself (which has no property name).\n * `visiting` breaks a cycle in a self-referential composition.\n */\n const collect = (\n model: Model,\n into: Model[],\n seen: Map<string, Model>,\n visiting: Set<Model>,\n ): void => {\n if (visiting.has(model)) return;\n visiting.add(model);\n for (const composed of model.composedModels ?? []) {\n // Only a member whose properties this flattening actually absorbs may be\n // marked inlined. A hoisted `oneOf` member has no named properties, so\n // marking it would have templates skip it while nothing carried its\n // constraint — the union would silently disappear.\n const isFlattenable =\n composed.export === 'interface' || composed.export === 'all-of';\n if (composed.vendorExtensions?.['x-aws-nx-hoisted'] && isFlattenable) {\n composed.isInlinedByAllOf = model.name;\n }\n if (composed.export === 'all-of') {\n collect(composed, into, seen, visiting);\n continue;\n }\n for (const prop of composed.properties ?? []) {\n if (!prop.name) continue;\n const existing = seen.get(prop.name);\n if (existing) {\n // `allOf` is a conjunction, so a property any branch requires is\n // required — taking only the first branch's flag would make it\n // optional because of the order the branches happen to appear in.\n existing.isRequired = existing.isRequired || prop.isRequired;\n continue;\n }\n // Copied, so raising `isRequired` above describes this composition\n // rather than mutating the composed schema every user of it shares.\n const flattenedProp = { ...prop };\n seen.set(prop.name, flattenedProp);\n into.push(flattenedProp);\n }\n }\n visiting.delete(model);\n };\n\n for (const model of models) {\n if (model.export !== 'all-of') continue;\n const flattened: Model[] = [];\n collect(model, flattened, new Map<string, Model>(), new Set<Model>());\n model.effectiveProperties = flattened;\n }\n};\n\n/**\n * The object-shaped properties a body model exposes for flattening, walking\n * allOf composition via `effectiveProperties` when present.\n */\nconst flattenableBodyProperties = (bodyModel: Model | undefined): Model[] => {\n if (!bodyModel) return [];\n if (bodyModel.export === 'interface' && !bodyModel.hasAdditionalProperties) {\n return bodyModel.properties ?? [];\n }\n if (bodyModel.export === 'all-of') {\n return bodyModel.effectiveProperties ?? [];\n }\n return [];\n};\n\n/**\n * Whether a body's fields can be flattened into the call signature without\n * clashing with path/query/header/cookie parameters. Only object-shaped\n * bodies (references to an interface or allOf) are eligible; discriminated\n * bases stay whole so marshalling can dispatch on the discriminator.\n */\nconst canFlattenBodyIntoRequest = (\n op: Operation,\n bodyParam: Model | undefined,\n bodyModel: Model | undefined,\n): boolean => {\n if (!bodyParam || bodyParam.export !== 'reference') return false;\n if (bodyModel?.discriminator) return false;\n const props = flattenableBodyProperties(bodyModel);\n if (props.length === 0) return false;\n const otherNames = new Set(\n (op.parameters ?? []).filter((p) => p.in !== 'body').map((p) => p.name),\n );\n return props.every((prop) => !otherNames.has(prop.name));\n};\n\n/**\n * Whether a response code always describes a successful response: a concrete\n * 2xx code, or the `2XX` range.\n *\n * `default` is excluded — it covers whatever the spec did not enumerate, which\n * spans both success and failure, so whether it is a success depends on the\n * operation's other responses. See {@link successResponsesOf}.\n */\nconst isSuccessCode = (code: number | string): boolean =>\n typeof code === 'number' ? code >= 200 && code < 300 : code === '2XX';\n\n/**\n * Every response the operation returns rather than raises for, in the order a\n * client checks them: concrete codes, then `2XX`, then `default`.\n *\n * An operation declaring `200` and `2XX` has two, since a 201 is described by\n * the range and is still a success. A `default` is only a success when the\n * operation declares no other — as the sole response it must describe the\n * success case, whereas alongside one it is the fallback for everything else.\n */\nconst successResponsesOf = (responses: Model[]): Model[] => {\n const declared = responses.filter((r) => isSuccessCode(r.code!));\n if (declared.length > 0) return declared;\n return responses.filter((r) => r.code === 'default');\n};\n\n/**\n * Build a language-agnostic description of an operation's inputs. Each input\n * carries its source (where in the HTTP request it is placed) plus the\n * underlying model — language templates decide how to translate that into\n * their idiomatic call signature (kwargs, a wrapper interface, etc).\n */\nconst buildRequestShape = (\n op: Operation,\n modelsByName: ModelsByName,\n): RequestShape => {\n const nonBody = (op.parameters ?? []).filter((p) => p.in !== 'body');\n const inputs: RequestInput[] = nonBody.map((p) => ({\n source: {\n kind: p.in as 'path' | 'query' | 'header' | 'cookie',\n wireName: p.prop ?? p.name,\n ...(p.collectionFormat ? { collectionFormat: p.collectionFormat } : {}),\n },\n model: p,\n isRequired: !!p.isRequired,\n isNullable: !!p.isNullable,\n description: p.description,\n specName: p.prop ?? p.name,\n }));\n\n const shape: RequestShape = { inputs, isSingleBodyInput: false };\n const bodyParam = op.parametersBody ?? undefined;\n if (bodyParam) {\n const mediaType =\n bodyParam.mediaType ??\n (bodyParam.mediaTypes ? bodyParam.mediaTypes[0] : undefined) ??\n undefined;\n const bodyModel = modelsByName[bodyParam.type];\n if (canFlattenBodyIntoRequest(op, bodyParam, bodyModel)) {\n for (const prop of flattenableBodyProperties(bodyModel)) {\n inputs.push({\n source: { kind: 'body-field', fieldName: prop.name },\n model: prop,\n isRequired: !!prop.isRequired,\n isNullable: !!prop.isNullable,\n description: prop.description,\n specName: prop.name,\n });\n }\n shape.bodyFromFields = { model: bodyModel, mediaType };\n } else {\n inputs.push({\n source: { kind: 'body', wireName: 'body' },\n model: bodyParam,\n isRequired: !!bodyParam.isRequired,\n isNullable: !!bodyParam.isNullable,\n description: bodyParam.description,\n specName: 'body',\n });\n shape.bodyAsSingleInput = { model: bodyParam, mediaType };\n if (nonBody.length === 0) shape.isSingleBodyInput = true;\n }\n }\n return shape;\n};\n\n/**\n * Build a language-agnostic error taxonomy for the operation: one entry per\n * non-success response bucket. Language templates turn these into typed\n * exception / error union shapes as appropriate.\n */\nconst buildErrorShape = (op: Operation): ErrorShape => ({\n // A response that can describe a success is not an error, even when it isn't\n // the one whose type the operation returns: raising on a declared `2XX` or\n // `default` would turn a 201 into an exception.\n entries: (op.responses ?? [])\n .filter((r) => !(op.successResponses ?? []).includes(r))\n .map((resp) => ({\n code: resp.code!,\n responseModel: resp,\n })),\n});\n\n/**\n * Annotate a typed entry (response, parameter, result) with whether the type\n * it references resolves to a module-level alias — a collection\n * (`list[...]` / `dict[str, ...]`), union or literal — rather than a class.\n * Python templates read `referencedCollectionKind` to pick pydantic's\n * `TypeAdapter(X)` over `X.model_validate(...)`.\n */\nconst annotateReferencedCollectionKind = (\n entry: Model | undefined,\n modelsByName: ModelsByName,\n): void => {\n if (!entry?.type) return;\n const referenced = modelsByName[entry.type];\n if (!referenced) return;\n if (referenced.export === 'dictionary') {\n entry.referencedCollectionKind = 'dictionary';\n } else if (referenced.export === 'array') {\n entry.referencedCollectionKind = 'array';\n } else if (\n referenced.export === 'one-of' ||\n referenced.export === 'any-of' ||\n referenced.export === 'enum' ||\n referenced.export === 'tuple'\n ) {\n entry.referencedCollectionKind = 'alias';\n }\n};\n\n/**\n * Attach the request shape, error shape and referenced-collection-kind\n * annotations to an operation.\n */\nconst annotateRequestAndErrorShapes = (\n op: Operation,\n modelsByName: ModelsByName,\n): void => {\n for (const parameter of op.parameters ?? []) {\n annotateReferencedCollectionKind(parameter, modelsByName);\n }\n annotateReferencedCollectionKind(\n op.parametersBody ?? undefined,\n modelsByName,\n );\n for (const response of op.responses ?? []) {\n annotateReferencedCollectionKind(response, modelsByName);\n }\n annotateReferencedCollectionKind(op.result, modelsByName);\n\n op.requestShape = buildRequestShape(op, modelsByName);\n op.errorShape = buildErrorShape(op);\n};\n\nconst TYPES_GEN_PREFIX = 'types.';\n\n/**\n * Attributes and methods the generated Python client defines on itself. An\n * operation or tag whose name would land on one of these is suffixed, so a\n * spec can't silently replace the client's own plumbing — an operation called\n * `close` would otherwise shadow the method that releases the httpx client.\n */\nexport const PYTHON_CLIENT_MEMBERS = new Set([\n 'aclose',\n 'close',\n 'config',\n 'url',\n 'query',\n 'query_string',\n 'headers',\n 'cookies',\n 'deep_object',\n 'dump',\n // Every remaining private helper the client template emits. A name missing\n // here is not merely shadowed: the operation replaces the helper, so every\n // *other* operation that calls it fails.\n 'as_dict',\n 'cookie_value',\n 'default_content_type',\n 'error',\n 'error_payload',\n 'is_file_part',\n 'is_object',\n 'json_body',\n 'multipart',\n 'part_text',\n 'scalar',\n 'send_with_url',\n 'stream_with_url',\n 'client',\n 'base_url',\n 'owns_client',\n 'parent',\n]);\n\n/**\n * A Python member name for an operation or tag that cannot collide with the\n * client's own members, nor with another operation or tag on the same client.\n */\nconst uniquePythonMemberName = (\n name: string,\n taken: Set<string>,\n fallback: string,\n): string => {\n // A leading underscore is how the client marks its own internals, so an\n // operation that snake-cases onto one is pushed out of that namespace too.\n let candidate = PYTHON_CLIENT_MEMBERS.has(name.replace(/^_+/, ''))\n ? `${name.replace(/^_+/, '')}_op`\n : name;\n // snake_case strips everything that isn't alphanumeric, so a name written\n // entirely in another script yields the empty string, and one starting with a\n // digit isn't a valid identifier. Either would emit code that doesn't parse.\n if (!candidate) {\n candidate = fallback;\n } else if (/^\\d/.test(candidate)) {\n candidate = `${fallback}_${candidate}`;\n }\n while (taken.has(candidate)) {\n candidate = `${candidate}_`;\n }\n taken.add(candidate);\n return candidate;\n};\n\n/**\n * Resolve the Python member name of every operation and tag, keeping them\n * distinct from each other and from the client's own members.\n */\nconst annotatePythonMemberNames = (data: CodeGenData): void => {\n const taken = new Set<string>();\n data.pythonTagNames = Object.fromEntries(\n Object.keys(data.operationsByTag).map((tag, index) => [\n tag,\n uniquePythonMemberName(\n toPythonName('property', tag),\n taken,\n `tag_${index + 1}`,\n ),\n ]),\n );\n data.allOperations.forEach((op, index) => {\n op.pythonMethodName = uniquePythonMemberName(\n op.operationIdSnakeCase ?? toPythonName('operation', op.name),\n taken,\n `operation_${index + 1}`,\n );\n });\n};\n\n/**\n * Attach `pythonClientType` to a typed entry — the bare `pythonType`\n * qualified with `types.` so client templates can reference model\n * classes through a single import.\n */\nconst annotatePythonClientType = (entry: Model | undefined): void => {\n if (!entry) return;\n entry.pythonTypeTree ??= toPythonTypeTree(entry);\n entry.pythonClientType = qualifyPythonType(\n entry.pythonTypeTree,\n TYPES_GEN_PREFIX,\n );\n};\n\n/**\n * A name for a generated class that no schema and no other generated class has\n * taken, recording it so later ones see it. The suffix keeps the name\n * recognisable rather than renaming it to something positional, and is a digit\n * rather than an underscore because class-name normalisation strips a trailing\n * one — so `FooError_` collapsed back onto `FooError`.\n */\nconst uniqueGeneratedName = (candidate: string, taken: Set<string>): string => {\n let name = candidate;\n for (let suffix = 2; taken.has(name); suffix++) {\n name = `${candidate}${suffix}`;\n }\n taken.add(name);\n return name;\n};\n\n/**\n * Final pass over all models + operation payloads to re-derive python type\n * annotations after links/composites are resolved, and to add the\n * python-specific annotations the py-client templates consume:\n * - `pythonType` / `pythonAnnotation` (refreshed — necessary for collection\n * aliases whose element type wasn't available first time through)\n * - `pythonClassName` / `pythonClientType`\n * - `requestShape.inputs[*].pythonName` / `.pythonAnnotation` (kwargs)\n * - `errorShape.exceptionClassName` / `.unionTypeName` / per-entry names\n * - `pythonMethodName` per operation and `pythonTagNames` per tag, escaped\n * clear of the members the generated client defines\n *\n * Called by the py-client generator rather than from the shared pipeline, so a\n * TypeScript consumer of the same spec never pays for fields only the Python\n * templates read — the same split as {@link assertNoClashingPythonNames}.\n */\nexport const annotatePythonData = (data: CodeGenData): void => {\n const modelsByName = indexModelsByName(data.models);\n annotatePythonMemberNames(data);\n // Every class `types.py` declares for a schema. The names derived per operation\n // below share that module, so they are checked against it rather than assumed\n // free — taking one emitted the same class twice and Python kept the last,\n // silently retyping every reference to the schema it replaced.\n const takenClassNames = new Set(\n data.models.map((model) => toPythonClassName(model.name)),\n );\n for (const model of data.models) {\n model.pythonClassName = toPythonClassName(model.name);\n model.pythonTypeTree = toPythonTypeTree(model);\n model.pythonType = toPythonType(model);\n model.pythonAnnotation = toPythonAnnotation(model);\n annotatePythonClientType(model);\n for (const prop of model.properties ?? []) {\n prop.pythonTypeTree = toPythonTypeTree(prop);\n prop.pythonType = toPythonType(prop);\n prop.pythonAnnotation = toPythonAnnotation(prop);\n annotatePythonClientType(prop);\n }\n for (const prop of model.effectiveProperties ?? []) {\n prop.pythonTypeTree = toPythonTypeTree(prop);\n prop.pythonType = toPythonType(prop);\n prop.pythonAnnotation = toPythonAnnotation(prop);\n annotatePythonClientType(prop);\n }\n annotatePythonClientType(model.additionalPropertiesModel);\n }\n\n for (const op of data.allOperations) {\n for (const parameter of op.parameters ?? []) {\n parameter.pythonTypeTree = toPythonTypeTree(parameter);\n parameter.pythonType = toPythonType(parameter);\n parameter.pythonAnnotation = toPythonAnnotation(parameter);\n annotatePythonClientType(parameter);\n }\n annotatePythonClientType(op.parametersBody ?? undefined);\n annotatePythonClientType(op.result);\n for (const response of op.responses ?? []) {\n annotatePythonClientType(response);\n annotatePythonClientType(response.itemSchemaModel);\n }\n\n const requestShape = op.requestShape;\n if (requestShape) {\n const seenNames = new Set<string>();\n for (const input of requestShape.inputs) {\n const rawName = input.model.pythonName || input.specName;\n // An operation input becomes a keyword argument, so it is escaped clear\n // of the locals and builtins the method body uses as well.\n const base = toPythonName('argument', rawName);\n let pythonName = base;\n if (seenNames.has(pythonName)) {\n // Qualify by where the input goes, then keep suffixing until the name\n // is free: the qualified form can itself collide (a header\n // `fooBarHeader` next to a query `fooBar` and a header `foo_bar` all\n // reach `foo_bar_header`), which would emit a duplicate argument.\n pythonName = `${base}_${input.source.kind.replace('-', '_')}`;\n while (seenNames.has(pythonName)) {\n pythonName = `${pythonName}_`;\n }\n }\n seenNames.add(pythonName);\n const baseType =\n input.model.pythonTypeTree ?? toPythonTypeTree(input.model);\n // An optional or nullable input may be left unset, so its annotation\n // admits None. Built as a tree so nothing has to unwrap it by name.\n const annotationType: PythonType =\n input.isRequired && !input.isNullable\n ? baseType\n : { kind: 'optional', inner: baseType };\n input.pythonName = pythonName;\n input.pythonTypeTree = annotationType;\n input.pythonAnnotation = qualifyPythonType(\n annotationType,\n TYPES_GEN_PREFIX,\n );\n }\n // Required-first so the generated keyword-only signature reads naturally.\n requestShape.inputs.sort(\n (a, b) => Number(b.isRequired) - Number(a.isRequired),\n );\n }\n\n if (op.requestTypeName) {\n op.pythonRequestTypeName = uniqueGeneratedName(\n toPythonClassName(op.requestTypeName),\n takenClassNames,\n );\n }\n\n const errorShape = op.errorShape;\n if (errorShape) {\n // The pascal-cased operation id is shared with TypeScript, where a leading\n // digit is legal; a Python class name beginning with one does not parse.\n const opPascal = toPythonClassName(op.operationIdPascalCase!);\n errorShape.exceptionClassName = `${opPascal}ApiError`;\n // Always a valid class name: templates emit `<name> = Never` for an\n // operation with no error responses, so the name is needed either way.\n errorShape.unionTypeName = uniqueGeneratedName(\n `${opPascal}Error`,\n takenClassNames,\n );\n errorShape.hasErrorEntries = errorShape.entries.length > 0;\n for (const entry of errorShape.entries) {\n const suffix =\n entry.code === 'default'\n ? 'Default'\n : String(entry.code).toUpperCase();\n entry.className = uniqueGeneratedName(\n `${opPascal}${suffix}Error`,\n takenClassNames,\n );\n entry.isExactCode = typeof entry.code === 'number';\n // Only collapse to a Literal for exact numeric codes — ranges like\n // 5XX expand to 100 codes, which produce a massive, unreadable\n // Literal and don't narrow `response.status_code` usefully anyway.\n entry.statusAnnotation = entry.isExactCode\n ? `Literal[${entry.code}]`\n : 'int';\n }\n }\n }\n};\n\n/**\n * Augment a service and each of its operations with the data needed for code\n * generation (names, imports, result/request types, behavioural flags), and\n * compute the set of models the service (ie API client) needs to import.\n */\nconst augmentService = (\n spec: Spec,\n service: Service,\n modelsByName: ModelsByName,\n): void => {\n const modelImports = service.operations.flatMap((op) =>\n augmentOperation(spec, op, modelsByName),\n );\n\n service.operations = orderBy(service.operations, (op) => op.uniqueName);\n service.modelImports = orderBy(\n uniqBy([...service.imports, ...modelImports], (x) => x),\n );\n service.className = `${service.name}Api`;\n service.nameSnakeCase = snakeCase(service.name);\n};\n\n/**\n * Augment a single operation with all the data the templates need, returning\n * the names of the models it references (for the service's import list).\n */\nconst augmentOperation = (\n spec: Spec,\n op: Operation,\n modelsByName: ModelsByName,\n): string[] => {\n const specOp = getSpecOperation(spec, op);\n\n assignOperationNames(op, specOp);\n\n op.vendorExtensions = vendorExtensionsOf(specOp);\n\n const modelImports = [\n ...(specOp ? augmentResponses(spec, op, specOp, modelsByName) : []),\n ...augmentParameters(spec, op, specOp, modelsByName),\n ];\n\n op.responses.forEach(addLanguageTypes);\n // Concrete codes first, then wildcard ranges, then `default` — templates emit\n // the checks in this order, and `default` renders as an unconditional branch\n // that would shadow anything after it. Sorting on `code` alone would leave\n // that to how the spec happened to enumerate its keys.\n op.responses = orderBy(op.responses, [\n (r) => (r.code === 'default' ? 2 : typeof r.code === 'number' ? 0 : 1),\n (r) => r.code,\n ]);\n\n // Result is the lowest successful response, otherwise the 2XX or default.\n op.result =\n op.responses.find(\n (r) => typeof r.code === 'number' && r.code >= 200 && r.code < 300,\n ) ?? op.responses.find((r) => r.code === '2XX' || r.code === 'default');\n // Already ordered concrete → wildcard → `default` by the sort above, which is\n // the order a client must check them in.\n op.successResponses = successResponsesOf(op.responses);\n\n op.operationIdPascalCase = pascalCase(op.uniqueName);\n op.operationIdSnakeCase = toPythonName('operation', op.uniqueName);\n\n if (op.parameters.length > 0) {\n const baseRequestTypeName = `${op.operationIdPascalCase}Request`;\n // Use the OperationRequest suffix when the standard Request name clashes\n // with an existing schema.\n op.requestTypeName = spec.components?.schemas?.[baseRequestTypeName]\n ? `${op.operationIdPascalCase}OperationRequest`\n : baseRequestTypeName;\n }\n\n augmentOperationBehaviour(op);\n\n return modelImports;\n};\n\n/**\n * Set an operation's name and its deduplicated variants from the vendor\n * extensions the normaliser added.\n */\nconst assignOperationNames = (\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n): void => {\n const deduplicatedOpId = specOp?.['x-aws-nx-deduplicated-op-id'] as\n | string\n | undefined;\n const dotNotationOpId = specOp?.['x-aws-nx-deduplicated-dot-op-id'] as\n | string\n | undefined;\n\n op.name = op.id ?? op.name;\n op.uniqueName = deduplicatedOpId ?? op.name;\n if (dotNotationOpId) {\n op.dotNotationName = dotNotationOpId;\n }\n};\n\n/**\n * Augment an operation's response models with schema-derived data, resolving\n * void responses and streaming item schemas. Returns the response model names\n * to import.\n */\n/**\n * A short, stable digest of a string. Each level of {@link schemaShapeKey} is\n * reduced to one of these rather than carrying its children's text upwards: a\n * deeply nested schema in a large document otherwise built a key past the\n * maximum string length, and the biggest published specs failed outright.\n */\nconst digest = (value: string): string =>\n createHash('sha1').update(value).digest('base64');\n\n/**\n * A key identifying a schema by its shape rather than by how it is written, so\n * two schemas can be compared for equivalence.\n *\n * Normalisation hoists only the preferred media type's inline schema into\n * `components`, and does so at any depth, so the same shape reaches here as a\n * `$ref` under one media type and inline under another — following references is\n * what lets those compare equal.\n *\n * Each reference is expanded once and its key reused: a large document shares a\n * handful of schemas across thousands of sites, and expanding every occurrence\n * exhausted the heap on the biggest published specs. `seen` breaks a cycle in a\n * self-referential schema by keying the reference itself, and such a schema is\n * left out of the cache since its key depends on where it was reached from.\n */\nconst schemaShapeKey = (\n spec: Spec,\n schema: unknown,\n cache: Map<string, string>,\n seen: ReadonlySet<string> = new Set(),\n): string => {\n if (!schema || typeof schema !== 'object') return JSON.stringify(schema);\n if (Array.isArray(schema)) {\n return digest(\n `[${schema.map((member) => schemaShapeKey(spec, member, cache, seen)).join(',')}]`,\n );\n }\n if (isRef(schema)) {\n const ref = (schema as OpenAPIV3.ReferenceObject).$ref;\n if (seen.has(ref)) return `cycle:${ref}`;\n const cached = cache.get(ref);\n if (cached !== undefined) return cached;\n const nested = new Set(seen).add(ref);\n const key = schemaShapeKey(spec, resolveIfRef(spec, schema), cache, nested);\n if (!key.startsWith('cycle:')) {\n cache.set(ref, key);\n }\n return key;\n }\n return digest(\n `{${Object.entries(schema)\n // Bookkeeping the normaliser adds to what it hoists, not part of the shape.\n .filter(([key]) => !key.startsWith('x-aws-nx-'))\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n .map(\n ([key, value]) => `${key}:${schemaShapeKey(spec, value, cache, seen)}`,\n )\n .join(',')}}`,\n );\n};\n\n/**\n * Keyed by the document, since its schemas recur across every operation and a\n * cache shared between documents would answer for the wrong one. Held weakly so\n * a spec's entries go when the spec does.\n */\nconst schemaShapeCaches = new WeakMap<Spec, Map<string, string>>();\nconst schemaShapeCacheFor = (spec: Spec): Map<string, string> => {\n let cache = schemaShapeCaches.get(spec);\n if (!cache) {\n cache = new Map<string, string>();\n schemaShapeCaches.set(spec, cache);\n }\n return cache;\n};\n\nconst augmentResponses = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject,\n modelsByName: ModelsByName,\n): string[] => {\n const modelImports = op.responses\n .filter((r) => r.export === 'reference')\n .map((r) => r.type);\n\n for (const response of op.responses) {\n // We cannot distinguish a composite of primitives at runtime (it all comes\n // back as text), so validate this away.\n if (\n response.export === 'reference' &&\n COMPOSED_SCHEMA_TYPES.has(modelsByName[response.type]?.export)\n ) {\n const composedPrimitives = (\n modelsByName[response.type].composedPrimitives ?? []\n ).filter(\n (p) =>\n !COLLECTION_TYPES.has(p.export) &&\n // `null` is the one primitive a runtime CAN tell from the others, and\n // it is how OpenAPI 3.1 spells an optional: FastAPI emits\n // `anyOf: [X, {type: 'null'}]` for `Optional[X]`. Counting it here\n // failed generation outright for an idiomatic optional response.\n p.type !== 'null',\n );\n if (composedPrimitives.length > 0) {\n throw new Error(\n `Operation \"${op.method} ${op.path}\" returns a composite schema of primitives with ${camelCase(modelsByName[response.type].export)}, which cannot be distinguished at runtime`,\n );\n }\n }\n\n const matchingSpecResponse = specOp.responses[`${response.code}`];\n if (!matchingSpecResponse) continue;\n\n const specResponse = resolveIfRef(spec, matchingSpecResponse);\n\n // When there's no content, the response type is 'void'\n if (!specResponse.content) {\n response.type = 'void';\n continue;\n }\n\n const mediaTypes = Object.keys(specResponse.content);\n response.mediaTypes = mediaTypes;\n\n // One status can only be parsed one way: the response's type comes from the\n // first media type, and nothing inspects the response's Content-Type to pick\n // between them. Where the schemas agree that is harmless (a `string` served\n // as either JSON or text), but where they differ the client would coerce one\n // wire form into the other's type and raise deep inside pydantic. Rejected\n // here for the same reason a composite of primitives is: it cannot be told\n // apart at runtime.\n // A streaming media type describes each item of the stream rather than the\n // whole body, so it is compared through `itemSchema` elsewhere and excluded\n // here — a JSONL response legitimately pairs with an `application/json`\n // declaration of the same item type.\n // Compared through their resolved form, and only where both declare one:\n // normalisation hoists just the preferred media type's inline schema into\n // `components` and leaves the others inline, so comparing as written pitted a\n // `$ref` against the very schema it was hoisted from and never matched. An\n // absent `schema` means unconstrained rather than different (a Media Type\n // Object may omit it), so it does not count as a distinct shape.\n const bodySchemas = new Set(\n mediaTypes\n .filter((mediaType) => !STREAMING_CONTENT_TYPES.has(mediaType))\n .map((mediaType) => specResponse.content![mediaType]?.schema)\n .filter((schema) => schema !== undefined)\n .map((schema) =>\n schemaShapeKey(spec, schema, schemaShapeCacheFor(spec)),\n ),\n );\n if (bodySchemas.size > 1) {\n throw new Error(\n `Operation \"${op.method} ${op.path}\" declares response ${response.code} with different schemas per media type (${mediaTypes.join(', ')}), which cannot be distinguished at runtime. Declare one schema for the status, or split the media types across separate operations.`,\n );\n }\n\n for (const mediaType of mediaTypes) {\n const responseContent = specResponse.content[mediaType];\n const declaredSchema = responseContent.schema as\n | { nullable?: boolean }\n | undefined;\n // A composite whose members include `null` — how OpenAPI 3.1 spells an\n // optional — is nullable, even though the `null` member itself is dropped\n // from the composite so it stays distinguishable at runtime.\n const composedModel = modelsByName[response.type];\n const hasNullMember = (composedModel?.composedPrimitives ?? []).some(\n (member) => member.type === 'null',\n );\n const responseSchema = resolveIfRef(spec, responseContent.schema);\n if (responseSchema) {\n augmentModelFromSchema(spec, response, responseSchema, modelsByName);\n // A response body the spec marks nullable may arrive as JSON `null`, so\n // the flag is carried onto the response for the templates that parse it.\n // Set here rather than in `augmentModelFromSchema`, which every property\n // also goes through: doing it there would change how a property\n // referencing a nullable schema is typed.\n //\n // Read from the declared schema as well as the resolved one: `nullable`\n // may sit beside a `$ref`, which resolution replaces wholesale.\n if (\n declaredSchema?.nullable ||\n hasNullMember ||\n (responseSchema as { nullable?: boolean }).nullable\n ) {\n response.isNullable = true;\n }\n }\n if (\n STREAMING_CONTENT_TYPES.has(mediaType) &&\n 'itemSchema' in responseContent\n ) {\n response.isJsonlStreaming = true;\n response.itemSchemaModel = buildOrReferenceModel(\n spec,\n modelsByName,\n responseContent.itemSchema as OpenApiSchemaOrRef,\n );\n }\n }\n }\n\n return modelImports;\n};\n\n/**\n * Augment an operation's parameter models with schema-derived data, resolving\n * request bodies and query/header collection formats. Returns the parameter\n * model names to import.\n */\nconst augmentParameters = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): string[] => {\n const specParametersByKey = getSpecParametersByKey(\n spec,\n specOp,\n getSpecPathParameters(spec, op),\n );\n\n const modelImports: string[] = [];\n\n for (const parameter of op.parameters) {\n if (parameter.export === 'reference') {\n modelImports.push(parameter.type);\n }\n\n const specParameter =\n specParametersByKey[\n specParameterKey({ in: parameter.in, name: parameter.prop })\n ];\n const specParameterSchema = resolveIfRef(spec, specParameter?.schema);\n if (specParameterSchema) {\n augmentModelFromSchema(\n spec,\n parameter,\n specParameterSchema,\n modelsByName,\n );\n }\n\n if (parameter.in === 'body') {\n augmentBodyParameter(spec, parameter, specOp, modelsByName);\n } else if (\n (parameter.in === 'query' || parameter.in === 'header') &&\n specParameter\n ) {\n parameter.collectionFormat = getCollectionFormat(\n parameter.in,\n specParameter,\n );\n if (parameter.in === 'query' && specParameter.allowReserved) {\n parameter.allowReserved = true;\n }\n } else if (parameter.in === 'path' && specParameter) {\n const style = specParameter.style;\n if (style === 'matrix' || style === 'label') {\n parameter.pathStyle = style;\n parameter.pathExplode = !!specParameter.explode;\n }\n }\n\n addLanguageTypes(parameter);\n }\n\n return modelImports;\n};\n\n/**\n * Augment a request body parameter with its schema (the body is not in the\n * spec's `parameters`, so it is resolved from `requestBody` here) and record\n * its acceptable media types.\n */\nconst augmentBodyParameter = (\n spec: Spec,\n parameter: Model,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): void => {\n // The request body parameter is named 'body' downstream.\n parameter.name = 'body';\n parameter.prop = 'body';\n\n const specBody = resolveIfRef(spec, specOp?.requestBody);\n if (!specBody) return;\n\n if (parameter.mediaType) {\n const declaredSchema = specBody.content?.[parameter.mediaType]?.schema as\n | { nullable?: boolean }\n | undefined;\n const bodySchema = resolveIfRef(\n spec,\n specBody.content?.[parameter.mediaType]?.schema,\n );\n if (bodySchema) {\n augmentModelFromSchema(spec, parameter, bodySchema, modelsByName);\n // A body the spec marks nullable may legitimately be sent as JSON `null`.\n // Read from the declared schema too: `nullable` may sit beside a `$ref`,\n // which resolution replaces wholesale.\n // A composite whose members include `null` is the 3.1 spelling of an\n // optional, and reaches here as a reference to a hoisted schema.\n const referenced = modelsByName[parameter.type];\n const hasNullMember = (referenced?.composedPrimitives ?? []).some(\n (member) => member.type === 'null',\n );\n if (\n declaredSchema?.nullable ||\n hasNullMember ||\n (bodySchema as { nullable?: boolean }).nullable\n ) {\n parameter.isNullable = true;\n }\n }\n }\n // Track all the media types that can be accepted in the request body\n parameter.mediaTypes = Object.keys(specBody.content);\n};\n\n/**\n * Translate an OpenAPI v3 parameter's style/explode into a v2-style\n * collectionFormat used when serialising array parameters.\n * @see https://spec.openapis.org/oas/v3.0.3.html#style-values\n */\nconst getCollectionFormat = (\n position: 'query' | 'header',\n specParameter: OpenAPIV3.ParameterObject,\n): CollectionFormat => {\n const style =\n specParameter.style ?? (position === 'query' ? 'form' : 'simple');\n const explode = specParameter.explode ?? style === 'form';\n\n if (position === 'header') {\n return explode ? 'multi' : 'csv';\n }\n // `deepObject` serialises an object as `key[prop]=value` pairs regardless of\n // explode; the object shape (not array collection) drives its serialisation.\n if (style === 'deepObject') {\n return 'deepObject';\n }\n return explode\n ? 'multi'\n : ((\n {\n spaceDelimited: 'ssv',\n pipeDelimited: 'pipes',\n simple: 'csv',\n form: 'csv',\n } as const\n )[style] ?? 'multi');\n};\n\n/**\n * Build the request parameter models for an operation — one model per parameter\n * position (query/path/header/cookie/body), named e.g.\n * `FooRequestQueryParameters`. Request bodies that can be represented directly\n * (the sole parameter, or a non-clashing object reference) are inlined rather\n * than given a wrapper model, and recorded on `op.explicitRequestBodyParameter`.\n */\nconst buildRequestParameterModels = (\n op: Operation,\n modelsByName: ModelsByName,\n takenModelNames: Set<string>,\n): Model[] => {\n if (!op.parameters || op.parameters.length === 0) {\n return [];\n }\n\n // Whether the request body can be represented directly, without a wrapper\n // model (ie the request will be the body itself).\n const canInlineBody = (body: Model): boolean => {\n // If the body is the only parameter, we can inline it no matter the type\n if (op.parameters.length === 1) {\n return true;\n }\n // We inline object bodies, so long as they aren't dictionaries (as\n // dictionary keys could clash with other parameters), and so long as they\n // don't have a property name that clashes with another parameter\n const hasClashingPropertyName = (\n modelsByName?.[body.type]?.properties ?? []\n ).some((prop) => op.parameters.some((param) => param.name === prop.name));\n return (\n body.export === 'reference' &&\n modelsByName?.[body.type]?.export !== 'dictionary' &&\n !hasClashingPropertyName\n );\n };\n\n // Group parameters by their position (`in`: query/path/header/cookie/body),\n // dropping any body that can be inlined.\n const parametersByPosition = op.parameters\n .filter((p) => !(p.in === 'body' && canInlineBody(p)))\n .reduce<{ [position: string]: Model[] }>(\n (acc, p) => ({ ...acc, [p.in]: [...(acc[p.in] ?? []), p] }),\n {},\n );\n\n // The body parameter was already renamed to \"body\" by augmentBodyParameter.\n op.explicitRequestBodyParameter = parametersByPosition['body']?.[0];\n\n return Object.entries(parametersByPosition).map(([position, parameters]) => {\n const name = uniqueGeneratedName(\n `${op.operationIdPascalCase}Request${upperFirst(position)}Parameters`,\n takenModelNames,\n );\n return createModel({\n description: op.description,\n export: 'interface',\n name,\n properties: parameters,\n type: name,\n isRequired: true,\n });\n });\n};\n\n/**\n * Augment a single model with schema-derived data (from its matching spec\n * schema, if any) and language-specific names and types.\n */\nconst augmentModel = (\n spec: Spec,\n model: Model,\n modelsByName: ModelsByName,\n): void => {\n model.nameSnakeCase = toPythonName('model', model.name);\n\n const matchingSpecModel = spec?.components?.schemas?.[model.name];\n if (matchingSpecModel) {\n const specModel = resolveIfRef(spec, matchingSpecModel);\n\n augmentModelFromSchema(spec, model, specModel, modelsByName);\n\n for (const property of model.properties) {\n const matchingSpecProperty = specModel.properties?.[property.name];\n if (matchingSpecProperty) {\n const specProperty = resolveIfRef(spec, matchingSpecProperty);\n augmentModelFromSchema(spec, property, specProperty, modelsByName);\n }\n }\n }\n\n model.properties.forEach(addLanguageTypes);\n\n // Resolve the discriminator's language property names for marshalling.\n if (model.discriminator) {\n model.discriminator.typescriptPropertyName = toTypeScriptName(\n model.discriminator.propertyName,\n );\n model.discriminator.pythonPropertyName = toPythonName(\n 'property',\n model.discriminator.propertyName,\n );\n }\n};\n\n/**\n * Ensure no two properties/parameters of an object model collapse onto the same\n * TypeScript identifier (e.g. `foo-bar` and `foo_bar` both camelCase to\n * `fooBar`, or a query and header parameter sharing a name within one request\n * position). Such a clash would emit a type with duplicate members that does\n * not compile, so fail fast with an actionable error instead.\n */\nconst assertNoClashingPropertyNames = (model: Model): void => {\n const seen = new Map<string, string>();\n for (const property of model.properties) {\n // Composite members are unnamed (their names are empty); skip them.\n if (!property.name) continue;\n const existing = seen.get(property.typescriptName!);\n if (existing !== undefined && existing !== property.name) {\n throw new Error(\n `Property name conflict in \"${model.name}\": \"${existing}\" and \"${property.name}\" both map to the TypeScript name \"${property.typescriptName}\". Please rename one of these in your OpenAPI specification.`,\n );\n }\n seen.set(property.typescriptName!, property.name);\n }\n};\n\n/**\n * The Python counterpart of {@link assertNoClashingPropertyNames}, run over the\n * flattened property list an `all-of` composite emits. Called by the Python\n * generator rather than the shared pipeline, so a TypeScript consumer is never\n * failed by a Python-specific name clash. Two members whose wire\n * names snake_case alike (`fooBar` and `foo_bar`) would emit the same field\n * twice, silently keeping only the last, so fail fast instead.\n *\n * A model's own properties are checked as well as the flattened list. The\n * TypeScript assertion does not cover them: escaping a keyword makes `from` and\n * `var_from` distinct in TypeScript (`from`/`varFrom`) but identical in Python,\n * so the class emitted the same field twice and pydantic kept only the last —\n * binding the wire value to the wrong type.\n */\nexport const assertNoClashingPythonNames = (model: Model): void => {\n const seen = new Map<string, string>();\n for (const property of [\n ...(model.effectiveProperties ?? []),\n ...(model.properties ?? []),\n ]) {\n if (!property.name) continue;\n const pythonName = toPythonName('property', property.name);\n const existing = seen.get(pythonName);\n if (existing !== undefined && existing !== property.name) {\n throw new Error(\n `Property name conflict in \"${model.name}\": \"${existing}\" and \"${property.name}\" both map to the Python name \"${pythonName}\". Please rename one of these in your OpenAPI specification.`,\n );\n }\n seen.set(pythonName, property.name);\n }\n};\n\n/**\n * The marshalling semantics of a property — two properties with the same key\n * convert identically on the wire (so either branch's conversion is safe).\n */\nconst marshallingKey = (\n m: Model,\n modelsByName: ModelsByName,\n visiting: Set<string> = new Set(),\n): string => {\n if (['date', 'date-time'].includes(m.format ?? '')) return 'date';\n if (m.type === 'binary') return 'binary';\n // Enums serialise as their bare primitive (no conversion).\n if (m.isEnum || m.export === 'enum') return 'plain';\n if (COLLECTION_TYPES.has(m.export)) {\n return `${m.export}<${m.link ? marshallingKey(m.link, modelsByName, visiting) : 'plain'}>`;\n }\n if (m.export === 'tuple') {\n return `tuple<${m.properties.map((p) => marshallingKey(p, modelsByName, visiting)).join(',')}>`;\n }\n if (m.export === 'reference' && !PRIMITIVE_TYPES.has(m.type)) {\n // Key on what the reference marshals to, not what it is called. The\n // normaliser hoists each inline schema to its own name, so two members\n // declaring an identical property get different names — keying on the name\n // alone rejected unions whose members convert identically.\n const referenced = modelsByName[m.type];\n if (!referenced || visiting.has(m.type)) return `ref:${m.type}`;\n const nested = new Set(visiting).add(m.type);\n if (referenced.export === 'one-of' || referenced.export === 'any-of') {\n const members = [\n ...(referenced.composedModels ?? []),\n ...(referenced.composedPrimitives ?? []),\n ]\n .map((member) => marshallingKey(member, modelsByName, nested))\n .sort();\n return `union<${[...new Set(members)].join('|')}>`;\n }\n if (referenced.export === 'interface' || referenced.export === 'all-of') {\n // Keyed on the shape too, for the same reason: two members declaring an\n // identical inline object property are hoisted to different names, and\n // keying on the name alone rejected a union whose members convert the same\n // way. `all-of` composes first, so its flattened properties are used.\n const properties =\n referenced.export === 'all-of'\n ? (referenced.effectiveProperties ?? [])\n : (referenced.properties ?? []);\n const fields = properties\n .filter((property) => property.name)\n .map(\n (property) =>\n `${property.name}:${property.isRequired ? '!' : '?'}${marshallingKey(property, modelsByName, nested)}`,\n )\n .sort();\n return `object<${fields.join(',')}>`;\n }\n return marshallingKey(referenced, modelsByName, nested);\n }\n return 'plain';\n};\n\n/**\n * A non-discriminated `oneOf`/`anyOf` of object members marshals by composing\n * every member, taking only the properties present on the value. That is sound\n * exactly when no wire property is claimed by two members with different\n * marshalling (e.g. a `date-time` in one and a plain string in another) —\n * otherwise the branch cannot be determined without guessing, so fail fast and\n * ask for a discriminator rather than corrupt data at runtime.\n */\nconst assertNoConflictingUnionMemberMarshalling = (\n model: Model,\n modelsByName: ModelsByName,\n): void => {\n if (\n (model.export !== 'one-of' && model.export !== 'any-of') ||\n model.discriminator\n ) {\n return;\n }\n const seen = new Map<string, { memberName: string; key: string }>();\n for (const member of model.composedModels ?? []) {\n for (const property of member.properties) {\n if (!property.name) continue;\n const key = marshallingKey(property, modelsByName);\n const existing = seen.get(property.name);\n if (existing && existing.key !== key) {\n throw new Error(\n `Schema \"${model.name}\" is a non-discriminated ${camelCase(model.export)} of \"${existing.memberName}\" and \"${member.name}\", which both declare a property \"${property.name}\" with different types, so the correct conversion cannot be determined. Add a discriminator to the union in your OpenAPI specification (e.g. with Pydantic, Field(discriminator=...)).`,\n );\n }\n if (!existing) {\n seen.set(property.name, { memberName: member.name, key });\n }\n }\n }\n};\n\n/**\n * An `application/x-www-form-urlencoded` body is form-encoded as `key=value`\n * pairs, so the wire form is only defined for a schema with named properties\n * (an object) or a primitive sent verbatim. A top-level array or tuple has no\n * property names to key on — encoding it would emit index keys (`0=a&1=b`) that\n * no form parser can decode — so fail fast rather than generate a client that\n * is silently wrong on the wire.\n */\nconst assertEncodableUrlEncodedBody = (op: Operation): void => {\n const body = op.parametersBody;\n if (!body?.mediaTypes) return;\n const mediaTypes = Array.isArray(body.mediaTypes)\n ? body.mediaTypes\n : [body.mediaTypes];\n // Match the wire media type the client actually sends: JSON is preferred, so\n // an array body offering both JSON and urlencoded is sent as JSON and is fine.\n const chosenMediaType =\n mediaTypes.find(\n (mt) => mt === 'application/json' || mt.endsWith('+json'),\n ) ?? mediaTypes[0];\n if (chosenMediaType !== 'application/x-www-form-urlencoded') {\n assertEncodableNonJsonBody(op, chosenMediaType, body);\n return;\n }\n if (body.isPrimitive) return;\n if (body.export === 'array' || body.export === 'tuple') {\n throw new Error(\n `Operation ${op.method} ${op.path} has an application/x-www-form-urlencoded request body whose schema is a ${body.export}, which has no defined form encoding. Use an object schema (its properties become the form fields) or a primitive schema (sent verbatim) in your OpenAPI specification.`,\n );\n }\n};\n\n/**\n * A structured body under a media type that is neither JSON nor a form has no\n * defined encoding. Both generators JSON-encoded it while asserting the declared\n * Content-Type, so an object went out as JSON bytes labelled `text/plain` — which\n * a conforming server rejects or mis-parses. Fail fast instead of shipping a wire\n * form that cannot be right.\n *\n * A scalar body is fine: it has a text form of its own and is sent verbatim.\n */\nconst assertEncodableNonJsonBody = (\n op: Operation,\n mediaType: string,\n body: Model,\n): void => {\n const base = mediaType.split(';')[0];\n if (base === 'application/json' || base.endsWith('+json')) return;\n if (FORM_BODY_MEDIA_TYPES.has(base)) return;\n // Binary bodies are sent as raw content, and a scalar as its text form.\n if (body.type === 'binary' || body.isPrimitive || body.isEnum) return;\n if (body.export === 'enum' || body.export === 'generic') return;\n throw new Error(\n `Operation ${op.method} ${op.path} declares a \"${mediaType}\" request body whose schema is an object or array, which has no defined encoding for that media type — it would be sent as JSON under a \"${mediaType}\" header. Declare the body as \"application/json\", or use a scalar schema which is sent verbatim.`,\n );\n};\n\nconst FORM_BODY_MEDIA_TYPES = new Set([\n 'multipart/form-data',\n 'application/x-www-form-urlencoded',\n]);\n\n/**\n * Group operations by their (camelCased) tags, collecting any untagged\n * operations separately.\n */\nconst groupOperationsByTag = (\n allOperations: Operation[],\n): {\n operationsByTag: { [tag: string]: Operation[] };\n untaggedOperations: Operation[];\n} => {\n const isTagged = (op: Operation): boolean => !!op.tags && op.tags.length > 0;\n\n const operationsByTag = allOperations\n .filter(isTagged)\n .flatMap((op) => op.tags!.map((tag) => [camelCase(tag), op] as const))\n .reduce<{ [tag: string]: Operation[] }>(\n (acc, [tag, op]) => ({ ...acc, [tag]: [...(acc[tag] ?? []), op] }),\n {},\n );\n\n return {\n operationsByTag,\n untaggedOperations: allOperations.filter((op) => !isTagged(op)),\n };\n};\n\n/**\n * Resolve a schema to its model: an existing named model for a `$ref`, or a\n * freshly built-and-augmented model for an inline (nested value) schema.\n */\nconst buildOrReferenceModel = (\n spec: Spec,\n modelsByName: ModelsByName,\n schema: OpenApiSchemaOrRef,\n): Model => {\n if (isRef(schema)) {\n const name = splitRef(schema.$ref)[2];\n return modelsByName[name];\n }\n const model = buildInlineModel(spec, schema);\n linkModel(spec, modelsByName, model, schema);\n augmentModelFromSchema(spec, model, schema, modelsByName);\n return model;\n};\n\n/**\n * The `x-*` vendor extensions declared on an object.\n */\nconst vendorExtensionsOf = (object: object | undefined): VendorExtensions =>\n Object.fromEntries(\n Object.entries(object ?? {}).filter(([key]) => key.startsWith('x-')),\n );\n\nconst augmentModelFromSchema = (\n spec: Spec,\n model: Model,\n schema: OpenApiSchema,\n modelsByName: ModelsByName,\n visited: Set<Model> = new Set(),\n) => {\n model.format = schema.format;\n model.deprecated = !!schema.deprecated;\n model.openapiType = schema.type;\n model.isEnum = !!schema.enum && schema.enum.length > 0;\n model.vendorExtensions = vendorExtensionsOf(schema);\n\n // A \"dictionary\" has only additional properties; an \"interface\" may mix\n // explicit and additional properties.\n if (schema.additionalProperties) {\n const additionalPropertiesModel = buildOrReferenceModel(\n spec,\n modelsByName,\n schema.additionalProperties === true ? {} : schema.additionalProperties,\n );\n\n if (model.export === 'dictionary') {\n // A dictionary carries a self-referential property; the rest are explicit\n const explicitProperties = model.properties.filter(\n (p) => !(p.export === 'dictionary' && p.name === model.name),\n );\n\n // Explicit properties make this an interface rather than a dictionary\n if (explicitProperties.length > 0 || schema.patternProperties) {\n model.export = 'interface';\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n model.properties = explicitProperties;\n }\n } else {\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n }\n }\n\n // Pattern properties can have different value types per pattern, so the model\n // is an interface rather than a dictionary.\n if (schema.patternProperties) {\n const patternProperties = resolveIfRef(spec, schema.patternProperties);\n\n if (model.export === 'dictionary') {\n model.export = 'interface';\n }\n\n model.hasPatternProperties = true;\n model.patternPropertiesModels = Object.entries(patternProperties)\n .map(([pattern, patternProperty]) => ({\n pattern,\n model: buildOrReferenceModel(spec, modelsByName, patternProperty),\n }))\n .filter((entry): entry is PatternPropertyModel => !!entry.model);\n }\n\n addLanguageTypes(model);\n\n visited.add(model);\n\n const recurse = (target: Model, subSchema: OpenApiSchema): void =>\n augmentModelFromSchema(spec, target, subSchema, modelsByName, visited);\n\n // Array element type.\n if (\n model.export === 'array' &&\n model.link &&\n 'items' in schema &&\n schema.items &&\n !visited.has(model.link)\n ) {\n recurse(model.link, resolveIfRef(spec, schema.items));\n }\n\n // Dictionary value type (additionalProperties may be `true` rather than a\n // schema).\n if (\n model.export === 'dictionary' &&\n model.link &&\n 'additionalProperties' in schema &&\n schema.additionalProperties &&\n !visited.has(model.link)\n ) {\n const subSchema = resolveIfRef(spec, schema.additionalProperties);\n if (subSchema !== true) {\n recurse(model.link, subSchema);\n }\n }\n\n // Tuple element types (3.1 `prefixItems`), positionally.\n if (model.export === 'tuple' && 'prefixItems' in schema) {\n const memberSchemas =\n (schema as { prefixItems?: OpenApiSchemaOrRef[] }).prefixItems ?? [];\n model.properties.forEach((member, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema && !visited.has(member)) {\n recurse(member, subSchema);\n }\n });\n }\n\n model.properties\n .filter((p) => !visited.has(p) && schema.properties?.[trim(p.name, `\"'`)])\n .forEach((property) =>\n recurse(\n property,\n resolveIfRef(spec, schema.properties![trim(property.name, `\"'`)]),\n ),\n );\n\n if (COMPOSED_SCHEMA_TYPES.has(model.export)) {\n const memberSchemas = compositeMemberSchemas(schema, model.export);\n model.properties.forEach((property, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema) {\n recurse(property, subSchema);\n }\n });\n }\n};\n\nconst addLanguageTypes = (model: Model) => {\n model.name = trim(model.name, `\"'`);\n model.typescriptName = toTypeScriptName(model.name);\n model.typescriptType = toTypeScriptType(model);\n model.pythonName = toPythonName('property', model.name);\n model.pythonType = toPythonType(model);\n model.isPrimitive =\n PRIMITIVE_TYPES.has(model.type) &&\n !COMPOSED_SCHEMA_TYPES.has(model.export) &&\n !COLLECTION_TYPES.has(model.export);\n};\n\nconst isOperationMutation = (op: Operation): boolean => {\n // x-mutation/x-query override the HTTP-method default.\n const { vendorExtensions } = op;\n if (vendorExtensions?.[VENDOR_EXTENSIONS.MUTATION]) {\n return true;\n } else if (vendorExtensions?.[VENDOR_EXTENSIONS.QUERY]) {\n return false;\n }\n return ['PATCH', 'POST', 'PUT', 'DELETE'].includes(op.method);\n};\n\nconst augmentInfiniteQuery = (op: Operation) => {\n const { paginationDisabled, cursorPropertyName } = getCursorOptions(op);\n\n const cursorProperty = op.parameters.find(\n (p) => p.name === cursorPropertyName,\n );\n\n // An infinite query is a paginated operation that accepts the cursor parameter\n op.isInfiniteQuery = !paginationDisabled && !!cursorProperty;\n if (op.isInfiniteQuery) {\n op.infiniteQueryCursorProperty = cursorProperty;\n }\n};\n\n/**\n * Resolve the pagination cursor options from an operation's `x-cursor` vendor\n * extension. Accepted forms (object variants exist because Smithy vendor\n * extensions must be objects):\n *\n * - `'property'` / `{ inputToken: 'property' }` — the input property to page on\n * - `false` / `{ enabled: false }` — disable pagination\n */\nconst getCursorOptions = (\n op: Operation,\n): { paginationDisabled: boolean; cursorPropertyName: string } => {\n const cursor = op.vendorExtensions?.[VENDOR_EXTENSIONS.CURSOR];\n\n // Defaults: pagination enabled, paging on a property named 'cursor'.\n if (cursor === false) {\n return { paginationDisabled: true, cursorPropertyName: 'cursor' };\n }\n if (typeof cursor === 'string') {\n return { paginationDisabled: false, cursorPropertyName: cursor };\n }\n const options = (cursor ?? {}) as { enabled?: boolean; inputToken?: unknown };\n return {\n paginationDisabled: options.enabled === false,\n cursorPropertyName:\n typeof options.inputToken === 'string' ? options.inputToken : 'cursor',\n };\n};\n\n/**\n * Add query/mutation, streaming and infinite-query flags to an operation.\n */\nconst augmentOperationBehaviour = (op: Operation) => {\n const isMutation = isOperationMutation(op);\n op.isMutation = isMutation;\n op.isQuery = !isMutation;\n\n op.isStreaming =\n !!op.vendorExtensions?.[VENDOR_EXTENSIONS.STREAMING] ||\n op.responses.some((res) => res.isJsonlStreaming);\n\n // For JSON-lines streaming, the result is each streamed item, so the client\n // method returns AsyncIterableIterator<itemSchemaModel>. Named (hoisted)\n // item schemas become references; inline primitives keep their own type.\n const jsonlResponse = op.responses.find((res) => res.isJsonlStreaming);\n if (jsonlResponse) {\n const itemSchemaModel = jsonlResponse.itemSchemaModel;\n const result = op.result;\n if (result && itemSchemaModel) {\n if (itemSchemaModel.name) {\n result.type = itemSchemaModel.name;\n result.typescriptType = itemSchemaModel.name;\n result.export = 'reference';\n } else {\n result.type = itemSchemaModel.type;\n result.typescriptType = itemSchemaModel.typescriptType;\n result.export = itemSchemaModel.export;\n result.format = itemSchemaModel.format;\n result.link = itemSchemaModel.link;\n result.isPrimitive = itemSchemaModel.isPrimitive;\n }\n }\n }\n\n // Add infinite query details if applicable\n if (!isMutation) {\n augmentInfiniteQuery(op);\n }\n};\n"],"names":["createHash","orderBy","trim","uniqBy","camelCase","pascalCase","snakeCase","toClassName","upperFirst","qualifyPythonType","toPythonAnnotation","toPythonClassName","toPythonName","toPythonType","toPythonTypeTree","toTypeScriptModelName","toTypeScriptName","toTypeScriptType","COLLECTION_TYPES","COMPOSED_SCHEMA_TYPES","createModel","DEFAULT_SERVICE_NAME","indexModelsByName","PRIMITIVE_TYPES","STREAMING_CONTENT_TYPES","VENDOR_EXTENSIONS","normaliseOpenApiSpecForCodeGen","buildClientData","buildInlineModel","compositeMemberSchemas","getSpecOperation","getSpecParametersByKey","getSpecPathParameters","linkModel","specParameterKey","isRef","resolveIfRef","splitRef","buildOpenApiCodeGenData","inSpec","spec","data","modelsByName","models","service","services","augmentService","allOperations","flatMap","s","operations","o","uniqueName","takenModelNames","Set","map","model","name","op","buildRequestParameterModels","augmentModel","typescriptName","typescriptType","assertNoClashingPropertyNames","assertNoConflictingUnionMemberMarshalling","assertEncodableUrlEncodedBody","d","operationsByTag","untaggedOperations","groupOperationsByTag","annotateAllOfFlattening","annotateRequestAndErrorShapes","result","info","vendorExtensions","vendorExtensionsOf","className","title","collect","into","seen","visiting","has","add","composed","composedModels","isFlattenable","export","isInlinedByAllOf","prop","properties","existing","get","isRequired","flattenedProp","set","push","delete","flattened","Map","effectiveProperties","flattenableBodyProperties","bodyModel","hasAdditionalProperties","canFlattenBodyIntoRequest","bodyParam","discriminator","props","length","otherNames","parameters","filter","p","in","every","isSuccessCode","code","successResponsesOf","responses","declared","r","buildRequestShape","nonBody","inputs","source","kind","wireName","collectionFormat","isNullable","description","specName","shape","isSingleBodyInput","parametersBody","undefined","mediaType","mediaTypes","type","fieldName","bodyFromFields","bodyAsSingleInput","buildErrorShape","entries","successResponses","includes","resp","responseModel","annotateReferencedCollectionKind","entry","referenced","referencedCollectionKind","parameter","response","requestShape","errorShape","TYPES_GEN_PREFIX","PYTHON_CLIENT_MEMBERS","uniquePythonMemberName","taken","fallback","candidate","replace","test","annotatePythonMemberNames","pythonTagNames","Object","fromEntries","keys","tag","index","forEach","pythonMethodName","operationIdSnakeCase","annotatePythonClientType","pythonTypeTree","pythonClientType","uniqueGeneratedName","suffix","annotatePythonData","takenClassNames","pythonClassName","pythonType","pythonAnnotation","additionalPropertiesModel","itemSchemaModel","seenNames","input","rawName","pythonName","base","baseType","annotationType","inner","sort","a","b","Number","requestTypeName","pythonRequestTypeName","opPascal","operationIdPascalCase","exceptionClassName","unionTypeName","hasErrorEntries","String","toUpperCase","isExactCode","statusAnnotation","modelImports","augmentOperation","imports","x","nameSnakeCase","specOp","assignOperationNames","augmentResponses","augmentParameters","addLanguageTypes","find","baseRequestTypeName","components","schemas","augmentOperationBehaviour","deduplicatedOpId","dotNotationOpId","id","dotNotationName","digest","value","update","schemaShapeKey","schema","cache","JSON","stringify","Array","isArray","member","join","ref","$ref","cached","nested","key","startsWith","schemaShapeCaches","WeakMap","schemaShapeCacheFor","composedPrimitives","Error","method","path","matchingSpecResponse","specResponse","content","bodySchemas","size","responseContent","declaredSchema","composedModel","hasNullMember","some","responseSchema","augmentModelFromSchema","nullable","isJsonlStreaming","buildOrReferenceModel","itemSchema","specParametersByKey","specParameter","specParameterSchema","augmentBodyParameter","getCollectionFormat","allowReserved","style","pathStyle","pathExplode","explode","specBody","requestBody","bodySchema","position","spaceDelimited","pipeDelimited","simple","form","canInlineBody","body","hasClashingPropertyName","param","parametersByPosition","reduce","acc","explicitRequestBodyParameter","matchingSpecModel","specModel","property","matchingSpecProperty","specProperty","typescriptPropertyName","propertyName","pythonPropertyName","assertNoClashingPythonNames","marshallingKey","m","format","isEnum","link","members","fields","memberName","chosenMediaType","mt","endsWith","assertEncodableNonJsonBody","isPrimitive","split","FORM_BODY_MEDIA_TYPES","isTagged","tags","object","visited","deprecated","openapiType","enum","additionalProperties","explicitProperties","patternProperties","hasPatternProperties","patternPropertiesModels","pattern","patternProperty","recurse","target","subSchema","items","memberSchemas","prefixItems","i","isOperationMutation","MUTATION","QUERY","augmentInfiniteQuery","paginationDisabled","cursorPropertyName","getCursorOptions","cursorProperty","isInfiniteQuery","infiniteQueryCursorProperty","cursor","CURSOR","options","enabled","input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