@trapi/swagger 2.0.1 → 2.0.2

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/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { BaseError } from "@ebec/core";
2
2
  import { BaseType, CollectionFormat, EnumType, Extension, IntersectionType, Metadata, Method, NestedObjectLiteralType, Parameter, ParameterSource, RefAliasType, RefEnumType, RefObjectType, ReferenceType, ResolverProperty, Response, UnionType, Validators, VariableType } from "@trapi/core";
3
-
4
3
  //#region src/core/constants.d.ts
5
4
  declare const Version: {
6
5
  readonly V2: "v2";
@@ -367,12 +366,12 @@ type PathsV3 = {
367
366
  };
368
367
  type BaseParameterV3 = {
369
368
  /**
370
- * Default: false
371
- */
369
+ * Default: false
370
+ */
372
371
  deprecated?: boolean;
373
372
  /**
374
- * Default: false
375
- */
373
+ * Default: false
374
+ */
376
375
  allowEmptyValue?: boolean;
377
376
  style?: string;
378
377
  explode?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/constants.ts","../src/core/schema/constants.ts","../src/core/schema/types.ts","../src/core/schema/v2/types.ts","../src/core/schema/v2/constants.ts","../src/core/schema/v3/constants.ts","../src/core/schema/v3/types.ts","../src/core/types.ts","../src/core/config/types.ts","../src/core/config/utils.ts","../src/core/error/codes.ts","../src/core/error/module.ts","../src/core/utils/character.ts","../src/core/utils/path.ts","../src/core/utils/object.ts","../src/core/utils/value.ts","../src/adapters/generator/abstract.ts","../src/adapters/generator/v2/module.ts","../src/adapters/generator/v3/module.ts","../src/app/module.ts","../src/app/save.ts"],"mappings":";;;;cAOa,OAAA;EAAA;;;;;KAMD,OAAA,UAAiB,OAAA,cAAqB,OAAO;AAAA,cAE5C,cAAA;EAAA,SAGH,IAAA;EAAA,SAAA,IAAA;AAAA;AAAA,KACE,cAAA,UAAwB,cAAA,cAA4B,cAAc;AAAA,cAEjE,YAAA;EAAA;;;;;KA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A,CAA6B,IAAA,EAAM,gBAAA,GAAoB,QAAA;EAAA,UAIvD,aAAA,CAAc,MAAA,EAAQ,QAAA,EAAU,QAAA;EAAA,UAkBhC,YAAA;EAAA,UAIA,qBAAA,CAAsB,IAAA,EAAM,SAAA,GAAa,QAAA;EAAA,eAyFpC,gBAAA;EAAA,QAgBP,kBAAA;EAAA,QAOA,mBAAA;;;AlBrrBZ;;;;UkB4uBY,0BAAA;AAAA;;;iBCnuBU,eAAA,cAA6B,OAAA,IAC/C,OAAA,EAAS,IAAA,CAAK,sBAAA;EAAuC,OAAA,EAAS,CAAA;AAAA,IAC/D,OAAA,CAAQ,gBAAA,CAAiB,CAAA;;;iBCRN,WAAA,CAClB,IAAA,EAAM,MAAA,GAAS,MAAA,EACf,OAAA,GAAS,kBAAA,GACV,OAAA,CAAQ,kBAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/core/constants.ts","../src/core/schema/constants.ts","../src/core/schema/types.ts","../src/core/schema/v2/types.ts","../src/core/schema/v2/constants.ts","../src/core/schema/v3/constants.ts","../src/core/schema/v3/types.ts","../src/core/types.ts","../src/core/config/types.ts","../src/core/config/utils.ts","../src/core/error/codes.ts","../src/core/error/module.ts","../src/core/utils/character.ts","../src/core/utils/path.ts","../src/core/utils/object.ts","../src/core/utils/value.ts","../src/adapters/generator/abstract.ts","../src/adapters/generator/v2/module.ts","../src/adapters/generator/v3/module.ts","../src/app/module.ts","../src/app/save.ts"],"mappings":";;;cAOa;;;;;;KAMD,iBAAiB,qBAAqB;cAErC;WAAA;WAAA;;KAID,wBAAwB,4BAA4B;cAEnD;;;;;;KAMD,sBAAsB,0BAA0B;;;cCpB/C;;;;;;KAMD,0BAA0B,8BAA8B;cAEvD;;;;;;;;;;;KAWD,wBAAwB,4BAA4B;cAEnD;;;;;;;;;;KAUD,sBAAsB,0BAA0B;;;KC3BhD;EACR,MAAM;EACN,OAAO;EACP,eAAe;;KAGP;EACR;EACA;EACA;EACA;EACA,UAAU;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M,YAAa;iBAyFpC;UAgBP;UAOA;;;;;;;UAuDA;;;;iBCnuBU,gBAAgB,aAAa,WAC/C,SAAS,KAAK;EAAuC,SAAS;IAC/D,QAAQ,iBAAiB;;;iBCRN,YAClB,MAAM,SAAS,QACf,UAAS,qBACV,QAAQ"}
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { isObject, merge } from "smob";
5
5
  import path from "node:path";
6
6
  import fs from "node:fs";
7
7
  import process from "node:process";
8
- import YAML from "yamljs";
8
+ import { YAMLWriter } from "locter";
9
9
  //#region src/core/config/utils.ts
10
10
  function buildSpecGeneratorOptions(input) {
11
11
  const servers = [];
@@ -1271,7 +1271,7 @@ function resolveFileName(name, format) {
1271
1271
  return `${(name ?? "swagger").replace(EXTENSION_PATTERN, "")}.${format}`;
1272
1272
  }
1273
1273
  function serialise(spec, format) {
1274
- if (format === DocumentFormat.YAML) return YAML.stringify(spec, 1e3);
1274
+ if (format === DocumentFormat.YAML) return new YAMLWriter().stringify(spec);
1275
1275
  return JSON.stringify(spec, null, 4);
1276
1276
  }
1277
1277
  async function saveSwagger(spec, options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["uniqueOperationId"],"sources":["../src/core/config/utils.ts","../src/core/constants.ts","../src/core/error/codes.ts","../src/core/error/module.ts","../src/core/schema/v2/constants.ts","../src/core/schema/v3/constants.ts","../src/core/schema/constants.ts","../src/core/utils/character.ts","../src/core/utils/path.ts","../src/core/utils/object.ts","../src/core/utils/value.ts","../src/adapters/generator/abstract.ts","../src/adapters/generator/v2/module.ts","../src/adapters/generator/v3/module.ts","../src/app/module.ts","../src/app/save.ts"],"sourcesContent":["/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { ServerOption, SpecGeneratorOptions, SpecGeneratorOptionsInput } from './types';\n\nexport function buildSpecGeneratorOptions(input: SpecGeneratorOptionsInput) : SpecGeneratorOptions {\n const servers : ServerOption[] = [];\n if (input.servers) {\n if (Array.isArray(input.servers)) {\n for (const server of input.servers) {\n if (typeof server === 'string') {\n servers.push({ url: server });\n } else {\n servers.push(server);\n }\n }\n } else if (typeof input.servers === 'string') {\n servers.push({ url: input.servers });\n } else {\n servers.push(input.servers);\n }\n }\n\n return {\n ...input,\n servers,\n };\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const Version = {\n V2: 'v2',\n V3: 'v3',\n V3_1: 'v3.1',\n V3_2: 'v3.2',\n} as const;\nexport type Version = typeof Version[keyof typeof Version];\n\nexport const DocumentFormat = {\n YAML: 'yaml',\n JSON: 'json',\n} as const;\nexport type DocumentFormat = typeof DocumentFormat[keyof typeof DocumentFormat];\n\nexport const SecurityType = {\n API_KEY: 'apiKey',\n BASIC: 'basic', // v2 only\n HTTP: 'http',\n OAUTH2: 'oauth2',\n} as const;\nexport type SecurityType = typeof SecurityType[keyof typeof SecurityType];\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const SwaggerErrorCode = {\n SPEC_NOT_BUILT: 'SWAGGER_SPEC_NOT_BUILT',\n ENUM_UNSUPPORTED_TYPE: 'SWAGGER_ENUM_UNSUPPORTED_TYPE',\n BODY_PARAMETER_DUPLICATE: 'SWAGGER_BODY_PARAMETER_DUPLICATE',\n BODY_FORM_CONFLICT: 'SWAGGER_BODY_FORM_CONFLICT',\n PARAMETER_SOURCE_UNSUPPORTED: 'SWAGGER_PARAMETER_SOURCE_UNSUPPORTED',\n METADATA_INVALID: 'SWAGGER_METADATA_INVALID',\n} as const;\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BaseError } from '@ebec/core';\n\nexport class SwaggerError extends BaseError {\n\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ParameterSourceV2 = {\n BODY: 'body',\n FORM_DATA: 'formData',\n HEADER: 'header',\n PATH: 'path',\n QUERY: 'query',\n} as const;\nexport type ParameterSourceV2 = typeof ParameterSourceV2[keyof typeof ParameterSourceV2];\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ParameterSourceV3 = {\n COOKIE: 'cookie',\n HEADER: 'header',\n PATH: 'path',\n QUERY: 'query',\n} as const;\nexport type ParameterSourceV3 = typeof ParameterSourceV3[keyof typeof ParameterSourceV3];\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const TransferProtocol = {\n HTTP: 'http',\n HTTPS: 'https',\n WS: 'ws',\n WSS: 'wss',\n} as const;\nexport type TransferProtocol = typeof TransferProtocol[keyof typeof TransferProtocol];\n\nexport const DataFormatName = {\n INT_32: 'int32',\n INT_64: 'int64',\n FLOAT: 'float',\n DOUBLE: 'double',\n BYTE: 'byte',\n BINARY: 'binary',\n DATE: 'date',\n DATE_TIME: 'date-time',\n PASSWORD: 'password',\n} as const;\nexport type DataFormatName = typeof DataFormatName[keyof typeof DataFormatName];\n\nexport const DataTypeName = {\n VOID: 'void',\n INTEGER: 'integer',\n NUMBER: 'number',\n BOOLEAN: 'boolean',\n STRING: 'string',\n ARRAY: 'array',\n OBJECT: 'object',\n FILE: 'file',\n} as const;\nexport type DataTypeName = typeof DataTypeName[keyof typeof DataTypeName];\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function removeDuplicateSlashes(str: string) : string {\n // URL-safe: a `:/` boundary (e.g. `http://`) is not collapsed.\n return str.replace(/([^:]\\/)\\/+/g, '$1');\n}\n\nexport function removeFinalCharacter(\n str: string,\n character: string,\n) {\n while (str.charAt(str.length - 1) === character && str.length > 0) {\n str = str.slice(0, -1);\n }\n\n return str;\n}\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function normalizePathParameters(str: string) : string {\n // <:id> -> {id}\n // todo: maybe escaping / is necessary\n str = str.replace(/<:([^/]+)>/g, '{$1}');\n\n // :id -> {id}\n str = str.replace(/:([^/]+)/g, '{$1}');\n\n // <id> -> {id}\n str = str.replace(/<([^/]+)>/g, '{$1}');\n\n return str;\n}\n\n// OpenAPI 3.x §4.8.8 requires every `paths` key to start with `/`. Joining a\n// controller path with a method path naively (template literal + slash\n// stripping) collapses the root combination — `''` + `'/'`, `'/'` + `''`,\n// `'/'` + `'/'` — to an empty string, which strict validators reject.\nexport function joinPaths(...segments: string[]): string {\n let result = segments.join('/').replace(/\\/{2,}/g, '/');\n if (!result.startsWith('/')) {\n result = `/${result}`;\n }\n if (result.length > 1 && result.endsWith('/')) {\n result = result.slice(0, -1);\n }\n return result;\n}\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function hasOwnProperty<X extends object, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown> {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function transformValueTo(\n type: 'string' | 'number' | 'integer' | 'boolean' | 'bigint',\n value: unknown,\n): string | number | boolean | null {\n if (value === null) {\n return null;\n }\n\n switch (type) {\n case 'integer':\n case 'number':\n return Number(value);\n case 'boolean':\n return !!value;\n case 'string':\n default:\n return String(value);\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n ArrayType,\n BaseType,\n EnumType,\n Extension,\n IntersectionType,\n Metadata,\n NestedObjectLiteralType,\n Parameter,\n ParameterSource,\n PrimitiveType,\n RefAliasType,\n RefEnumType,\n RefObjectType,\n ReferenceType,\n ResolverProperty,\n TupleType,\n UnionType,\n Validators, \n VariableType, \n} from '@trapi/core';\nimport {\n TypeName,\n isArrayType,\n isEnumType,\n isIntersectionType,\n isNestedObjectLiteralType,\n isNeverType,\n isPrimitiveType,\n isReferenceType,\n isTupleType,\n isUndefinedType,\n isUnionType,\n isVoidType,\n} from '@trapi/core';\n\nimport { isObject } from 'smob';\nimport { buildSpecGeneratorOptions } from '../../core/config';\nimport { SwaggerError, SwaggerErrorCode } from '../../core/error';\nimport type { SpecGeneratorOptions, SpecGeneratorOptionsInput } from '../../core/config';\nimport { DataFormatName, DataTypeName } from '../../core/schema';\nimport type { ValidatorOpenApiMeta } from '../../core/types';\nimport { transformValueTo } from '../../core/utils';\n\nimport type {\n BaseSchema,\n Info,\n SchemaV2,\n SchemaV3,\n SpecV2,\n SpecV3,\n} from '../../core/schema';\n\nexport abstract class AbstractSpecGenerator<Spec extends SpecV2 | SpecV3, Schema extends SchemaV3 | SchemaV2> {\n protected spec: Spec | undefined;\n\n protected readonly metadata: Metadata;\n\n protected readonly config: SpecGeneratorOptions;\n\n constructor(metadata: Metadata, config: SpecGeneratorOptionsInput) {\n this.metadata = metadata;\n this.config = buildSpecGeneratorOptions(config);\n }\n\n public abstract build(): Promise<Spec>;\n\n protected buildInfo() {\n const info: Info = {\n title: this.config.name || 'Documentation',\n version: this.config.version || '1.0.0',\n };\n\n if (this.config.description) {\n info.description = this.config.description;\n }\n\n if (this.config.license) {\n info.license = { name: this.config.license };\n }\n\n return info;\n }\n\n protected buildTags() {\n // Tag entries are emitted only for controllers that declare extensions.\n // When multiple controllers share a tag name, their extensions merge into\n // the same Tag entry; on key conflict, the last controller processed wins\n // (silent — strict-mode validation is a future addition).\n // Hidden controllers are skipped. If a controller declares extensions but\n // no tags, the controller name is used as a synthetic tag name so the\n // extensions still surface in the spec.\n const tagMap = new Map<string, { name: string } & Record<string, unknown>>();\n\n for (const controller of this.metadata.controllers) {\n if (controller.hidden) {\n continue;\n }\n\n const extensions = controller.extensions ?? [];\n if (extensions.length === 0) {\n continue;\n }\n\n const tagNames = controller.tags.length > 0 ? controller.tags : [controller.name];\n const extensionFields = this.transformExtensions(extensions);\n\n for (const tagName of tagNames) {\n let entry = tagMap.get(tagName);\n if (!entry) {\n entry = { name: tagName };\n tagMap.set(tagName, entry);\n }\n\n Object.assign(entry, extensionFields);\n }\n }\n\n return Array.from(tagMap.values());\n }\n\n protected getSchemaForType(type: BaseType): Schema | BaseSchema<Schema> {\n if (isVoidType(type) || isUndefinedType(type) || isNeverType(type)) {\n return {} as Schema;\n } if (isReferenceType(type)) {\n return this.getSchemaForReferenceType(type);\n } if (isPrimitiveType(type)) {\n return this.getSchemaForPrimitiveType(type);\n } if (isArrayType(type)) {\n return this.getSchemaForArrayType(type);\n } if (isTupleType(type)) {\n return this.getSchemaForTupleType(type);\n } if (isEnumType(type)) {\n return this.getSchemaForEnumType(type);\n } if (isUnionType(type)) {\n return this.getSchemaForUnionType(type);\n } if (isIntersectionType(type)) {\n return this.getSchemaForIntersectionType(type);\n } if (isNestedObjectLiteralType(type)) {\n return this.getSchemaForObjectLiteralType(type);\n }\n\n return {} as Schema;\n }\n\n protected abstract getSchemaForIntersectionType(type: IntersectionType): Schema;\n\n protected getSchemaForEnumType(enumType: EnumType): Schema {\n const nullable = enumType.members.includes(null);\n const nonNullMembers = enumType.members.filter(\n (m): m is string | number | boolean => m !== null,\n );\n const type = this.decideEnumType(nonNullMembers);\n\n const schema = {\n type,\n enum: enumType.members.map((member) => transformValueTo(type, member)),\n } as Schema;\n\n this.applyNullable(schema, nullable);\n\n return schema;\n }\n\n protected abstract applyNullable(schema: Schema, nullable: boolean): void;\n\n private getSchemaForPrimitiveType(type: PrimitiveType): BaseSchema<Schema> {\n const PrimitiveSwaggerTypeMap: Partial<Record<TypeName, BaseSchema<Schema>>> = {\n [TypeName.ANY]: { additionalProperties: true },\n [TypeName.BINARY]: { type: DataTypeName.STRING, format: DataFormatName.BINARY },\n [TypeName.BOOLEAN]: { type: DataTypeName.BOOLEAN },\n [TypeName.BUFFER]: { type: DataTypeName.STRING, format: DataFormatName.BYTE },\n [TypeName.BYTE]: { type: DataTypeName.STRING, format: DataFormatName.BYTE },\n [TypeName.DATE]: { type: DataTypeName.STRING, format: DataFormatName.DATE },\n [TypeName.DATETIME]: { type: DataTypeName.STRING, format: DataFormatName.DATE_TIME },\n [TypeName.DOUBLE]: { type: DataTypeName.NUMBER, format: DataFormatName.DOUBLE },\n [TypeName.FILE]: { type: DataTypeName.STRING, format: DataFormatName.BINARY },\n [TypeName.FLOAT]: { type: DataTypeName.NUMBER, format: DataFormatName.FLOAT },\n [TypeName.BIGINT]: { type: DataTypeName.INTEGER },\n [TypeName.INTEGER]: { type: DataTypeName.INTEGER, format: DataFormatName.INT_32 },\n [TypeName.LONG]: { type: DataTypeName.INTEGER, format: DataFormatName.INT_64 },\n [TypeName.OBJECT]: {\n type: DataTypeName.OBJECT,\n additionalProperties: true,\n },\n [TypeName.STRING]: { type: DataTypeName.STRING },\n [TypeName.UNDEFINED]: {},\n };\n\n return PrimitiveSwaggerTypeMap[type.typeName] || { type: DataTypeName.OBJECT };\n }\n\n private getSchemaForArrayType(arrayType: ArrayType): BaseSchema<Schema> {\n return {\n type: DataTypeName.ARRAY,\n items: this.getSchemaForType(arrayType.elementType),\n };\n }\n\n private getSchemaForTupleType(tupleType: TupleType): BaseSchema<Schema> {\n if (tupleType.elements.length === 0) {\n return {\n type: DataTypeName.ARRAY,\n items: {},\n };\n }\n\n const elementSchemas = tupleType.elements.map((el) => this.getSchemaForType(el.type));\n\n if (elementSchemas.length === 1) {\n return {\n type: DataTypeName.ARRAY,\n items: elementSchemas[0],\n };\n }\n\n // Multiple elements → array with anyOf items\n return {\n type: DataTypeName.ARRAY,\n items: { anyOf: elementSchemas },\n };\n }\n\n public getSchemaForObjectLiteralType(objectLiteral: NestedObjectLiteralType): BaseSchema<Schema> {\n const properties = this.buildProperties(objectLiteral.properties);\n\n const additionalProperties = objectLiteral.additionalProperties &&\n this.getSchemaForType(objectLiteral.additionalProperties);\n\n const required = objectLiteral.properties\n .filter((prop: ResolverProperty) => prop.required && !this.isUndefinedProperty(prop))\n .map((prop: ResolverProperty) => prop.name);\n\n // An empty list required: [] is not valid.\n // If all properties are optional, do not specify the required keyword.\n return {\n properties,\n ...(additionalProperties && { additionalProperties }),\n ...(required && required.length && { required }),\n type: DataTypeName.OBJECT,\n } as BaseSchema<Schema>;\n }\n\n protected getSchemaForReferenceType(referenceType: ReferenceType): Schema {\n return { $ref: `${this.getRefPrefix()}${referenceType.refName}` } as Schema;\n }\n\n protected abstract getRefPrefix(): string;\n\n protected abstract getSchemaForUnionType(type: UnionType) : Schema;\n\n // ----------------------------------------------------------------\n\n protected buildSchemaForRefAlias(referenceType: RefAliasType): Schema {\n const swaggerType = this.getSchemaForType(referenceType.type);\n const format = referenceType.format as DataFormatName;\n\n return {\n ...(swaggerType as Schema),\n default: referenceType.default ?? swaggerType.default,\n example: referenceType.example ?? swaggerType.example,\n format: format ?? swaggerType.format,\n description: referenceType.description ?? swaggerType.description,\n ...this.transformValidators(referenceType.validators),\n };\n }\n\n protected buildSchemaForRefEnum(referenceType: RefEnumType): Schema {\n const output = {\n ...this.getSchemaForEnumType({\n typeName: TypeName.ENUM,\n members: referenceType.members,\n }),\n description: referenceType.description,\n } as Schema;\n\n if (\n typeof referenceType.memberNames !== 'undefined' &&\n referenceType.members.length === referenceType.memberNames.length\n ) {\n (output as any)['x-enum-varnames'] = referenceType.memberNames;\n }\n\n return output;\n }\n\n protected buildSchemasForReferenceTypes(extendFn?: (output: Schema, input: ReferenceType) => void) : Record<string, Schema> {\n const output: Record<string, Schema> = {};\n\n for (const referenceType of Object.values(this.metadata.referenceTypes)) {\n switch (referenceType.typeName) {\n case TypeName.REF_ALIAS: {\n output[referenceType.refName] = this.buildSchemaForRefAlias(referenceType);\n break;\n }\n case TypeName.REF_ENUM: {\n output[referenceType.refName] = this.buildSchemaForRefEnum(referenceType);\n break;\n }\n case TypeName.REF_OBJECT: {\n output[referenceType.refName] = this.buildSchemaForRefObject(referenceType);\n break;\n }\n }\n\n if (typeof extendFn === 'function') {\n extendFn(output[referenceType.refName]!, referenceType);\n }\n }\n\n return output;\n }\n\n // ----------------------------------------------------------------\n\n protected isUndefinedProperty(input: ResolverProperty) {\n return isUndefinedType(input.type) ||\n (isUnionType(input.type) && input.type.members.some((el) => isUndefinedType(el)));\n }\n\n protected buildProperties(properties: ResolverProperty[]): Record<string, Schema> {\n const output: Record<string, Schema> = {};\n\n properties.forEach((property) => {\n const swaggerType = this.getSchemaForType(property.type) as Schema;\n\n if (swaggerType.$ref && this.shouldStripRefSiblings()) {\n output[property.name] = { $ref: swaggerType.$ref } as Schema;\n return;\n }\n\n swaggerType.description = property.description;\n swaggerType.example = property.example;\n swaggerType.format = property.format as DataFormatName || swaggerType.format;\n this.assignPropertyDefaults(swaggerType, property);\n\n if (property.deprecated) {\n this.markPropertyDeprecated(swaggerType);\n }\n\n const extensions = this.transformExtensions(property.extensions);\n const validators = this.transformValidators(property.validators);\n output[property.name] = {\n ...swaggerType,\n ...validators,\n ...extensions,\n };\n });\n\n return output;\n }\n\n protected abstract markPropertyDeprecated(schema: Schema): void;\n\n protected shouldStripRefSiblings(): boolean {\n // V2 (Swagger 2.0) and V3 (3.0): $ref must be the only key.\n // V3 (3.1+): $ref siblings are allowed. Override to return false.\n return true;\n }\n\n protected assignPropertyDefaults(_schema: Schema, _property: ResolverProperty): void {\n // No-op by default. V3 overrides to set schema.default = property.default.\n }\n\n protected buildSchemaForRefObject(referenceType: RefObjectType): Schema {\n const required = referenceType.properties\n .filter((p) => p.required && !this.isUndefinedProperty(p))\n .map((p) => p.name);\n\n const output = {\n description: referenceType.description,\n properties: this.buildProperties(referenceType.properties),\n required: required && required.length > 0 ? Array.from(new Set(required)) : undefined,\n type: DataTypeName.OBJECT,\n } as unknown as Schema;\n\n if (referenceType.additionalProperties) {\n (output as any).additionalProperties = this.resolveAdditionalProperties(referenceType.additionalProperties);\n }\n\n if (referenceType.example !== undefined) {\n output.example = referenceType.example;\n }\n\n return output;\n }\n\n protected abstract resolveAdditionalProperties(type: BaseType): Schema | boolean;\n\n protected determineTypesUsedInEnum(anEnum: Array<string | number | boolean | null>) : VariableType[] {\n const set = new Set<VariableType>();\n for (const element of anEnum) {\n if (element === null) {\n continue;\n }\n\n set.add(typeof element);\n }\n\n return Array.from(set);\n }\n\n protected decideEnumType(\n input: Array<string | number | boolean>,\n ): 'string' | 'number' | 'boolean' {\n const types = this.determineTypesUsedInEnum(input);\n\n if (types.length === 1) {\n const value = types[0];\n if (\n value === 'string' ||\n value === 'number' ||\n value === 'boolean'\n ) {\n return value;\n }\n\n throw new SwaggerError({\n message: `Enum contains unsupported type '${types[0] || 'unknown'}'. Only string, number, and boolean values are allowed.`,\n code: SwaggerErrorCode.ENUM_UNSUPPORTED_TYPE,\n });\n }\n\n const unsupportedTypes = types.filter(\n (type) => type !== 'string' && type !== 'number' && type !== 'boolean',\n );\n if (unsupportedTypes.length > 0) {\n throw new SwaggerError({\n message: `Enum contains unsupported types: ${unsupportedTypes.join(', ')}. Only string, number, and boolean values are allowed.`,\n code: SwaggerErrorCode.ENUM_UNSUPPORTED_TYPE,\n });\n }\n\n return 'string';\n }\n\n protected getOperationId(name: string) {\n return name.charAt(0).toUpperCase() + name.substring(1);\n }\n\n protected groupParameters(items: Parameter[]) : Partial<Record<ParameterSource, Parameter[]>> {\n const output : Partial<Record<ParameterSource, Parameter[]>> = {};\n\n for (const item of items) {\n const bucket = output[item.in] ?? (output[item.in] = []);\n bucket.push(item);\n }\n\n return output;\n }\n\n protected transformExtensions(input?: Extension[]) : Record<string, any> {\n if (!input) {\n return {};\n }\n\n const output : Record<string, any> = {};\n for (const extension of input) {\n const key = extension.key.startsWith('x-') ? extension.key : `x-${extension.key}`;\n output[key] = extension.value;\n }\n\n return output;\n }\n\n protected transformValidators(input?: Validators) : Record<string, any> {\n if (!isObject(input)) {\n return {};\n }\n\n const output : Record<string, any> = {};\n for (const [name, validator] of Object.entries(input)) {\n const mapping = validator.meta?.openApi ?? DEFAULT_VALIDATOR_OPENAPI_MAPPINGS[name];\n if (!mapping || mapping.kind === 'ignore') {\n continue;\n }\n\n if (mapping.kind === 'keyword') {\n output[mapping.key] = validator.value;\n } else if (mapping.kind === 'format') {\n output.format = mapping.format;\n }\n }\n\n return output;\n }\n}\n\n// Default OpenAPI mappings for canonical validator names. Validator names that\n// do not appear here and that carry no `meta.openApi` hint are dropped — this\n// keeps third-party / custom validators out of the spec unless their handler\n// declares how to emit them.\nconst DEFAULT_VALIDATOR_OPENAPI_MAPPINGS: Record<string, ValidatorOpenApiMeta> = {\n maxLength: { kind: 'keyword', key: 'maxLength' },\n minLength: { kind: 'keyword', key: 'minLength' },\n maximum: { kind: 'keyword', key: 'maximum' },\n minimum: { kind: 'keyword', key: 'minimum' },\n pattern: { kind: 'keyword', key: 'pattern' },\n maxItems: { kind: 'keyword', key: 'maxItems' },\n minItems: { kind: 'keyword', key: 'minItems' },\n uniqueItems: { kind: 'keyword', key: 'uniqueItems' },\n};\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n BaseType,\n EnumType,\n IntersectionType,\n Method,\n Parameter,\n RefObjectType,\n Response,\n Type,\n UnionType,\n} from '@trapi/core';\nimport {\n ParameterSource,\n TypeName,\n isAnyType,\n isBinaryType,\n isEnumType,\n isNeverType,\n isRefEnumType,\n isRefObjectType,\n isUndefinedType,\n isVoidType,\n} from '@trapi/core';\nimport { URL } from 'node:url';\nimport { merge } from 'smob';\n\nimport type {\n BaseSchema,\n OperationV2,\n ParameterV2,\n Path,\n ResponseV2,\n SchemaV2,\n SecurityV2,\n SpecV2,\n} from '../../../core/schema';\nimport { DataTypeName, ParameterSourceV2 } from '../../../core/schema';\nimport type { SecurityDefinitions } from '../../../core/types';\nimport { SwaggerError, SwaggerErrorCode } from '../../../core/error';\nimport { joinPaths, normalizePathParameters } from '../../../core/utils';\nimport { AbstractSpecGenerator } from '../abstract';\n\nfunction uniqueOperationId(base: string, used: Set<string>): string {\n if (!used.has(base)) {\n used.add(base);\n return base;\n }\n let counter = 2;\n while (used.has(`${base}_${counter}`)) {\n counter += 1;\n }\n const candidate = `${base}_${counter}`;\n used.add(candidate);\n return candidate;\n}\n\nexport class V2Generator extends AbstractSpecGenerator<SpecV2, SchemaV2> {\n async build() : Promise<SpecV2> {\n if (typeof this.spec !== 'undefined') {\n return this.spec;\n }\n\n let spec: SpecV2 = {\n definitions: this.buildSchemasForReferenceTypes(),\n info: this.buildInfo(),\n paths: this.buildPaths(),\n swagger: '2.0',\n };\n\n spec.securityDefinitions = this.config.securityDefinitions ?\n V2Generator.translateSecurityDefinitions(this.config.securityDefinitions) :\n {};\n\n if (this.config.consumes) {\n spec.consumes = this.config.consumes;\n }\n\n if (this.config.produces) {\n spec.produces = this.config.produces;\n }\n\n const firstServer = this.config.servers?.[0];\n if (firstServer) {\n const url = new URL(firstServer.url, 'http://localhost:3000/');\n\n spec.host = url.host;\n if (url.pathname) {\n spec.basePath = url.pathname;\n }\n }\n\n const tags = this.buildTags();\n if (tags.length > 0) {\n spec.tags = tags;\n }\n\n if (this.config.specificationExtra) {\n spec = merge(spec, this.config.specificationExtra);\n }\n\n this.spec = spec;\n\n return spec;\n }\n\n private static translateSecurityDefinitions(securityDefinitions: SecurityDefinitions) : Record<string, SecurityV2> {\n const definitions : Record<string, SecurityV2> = {};\n\n for (const [key, securityDefinition] of Object.entries(securityDefinitions)) {\n switch (securityDefinition.type) {\n case 'http':\n if (securityDefinition.scheme === 'basic') {\n definitions[key] = { type: 'basic' };\n }\n break;\n case 'apiKey':\n definitions[key] = securityDefinition;\n break;\n case 'oauth2':\n if (securityDefinition.flows.implicit) {\n definitions[`${key}Implicit`] = {\n type: 'oauth2',\n flow: 'implicit',\n authorizationUrl: securityDefinition.flows.implicit.authorizationUrl,\n scopes: securityDefinition.flows.implicit.scopes,\n };\n }\n\n if (securityDefinition.flows.password) {\n definitions[`${key}Password`] = {\n type: 'oauth2',\n flow: 'password',\n tokenUrl: securityDefinition.flows.password.tokenUrl,\n scopes: securityDefinition.flows.password.scopes,\n };\n }\n\n if (securityDefinition.flows.authorizationCode) {\n definitions[`${key}AccessCode`] = {\n type: 'oauth2',\n flow: 'accessCode',\n tokenUrl: securityDefinition.flows.authorizationCode.tokenUrl,\n authorizationUrl: securityDefinition.flows.authorizationCode.authorizationUrl,\n scopes: securityDefinition.flows.authorizationCode.scopes,\n };\n }\n\n if (securityDefinition.flows.clientCredentials) {\n definitions[`${key}Application`] = {\n type: 'oauth2',\n flow: 'application',\n tokenUrl: securityDefinition.flows.clientCredentials.tokenUrl,\n scopes: securityDefinition.flows.clientCredentials.scopes,\n };\n }\n\n break;\n }\n }\n\n return definitions;\n }\n\n protected resolveAdditionalProperties(_type: BaseType): SchemaV2 | boolean {\n return true;\n }\n\n protected markPropertyDeprecated(schema: SchemaV2): void {\n schema['x-deprecated'] = true;\n }\n\n\n /*\n Path & Parameter ( + utils)\n */\n\n private buildPaths() {\n const output: Record<string, Path<OperationV2, ResponseV2>> = {};\n const usedOperationIds = new Set<string>();\n\n const unique = <T extends unknown[]>(input: T) : T => [...new Set(input)] as T;\n\n this.metadata.controllers.forEach((controller) => {\n if (controller.hidden) {\n return;\n }\n\n const controllerPaths = controller.paths.length === 0 ? [''] : controller.paths;\n\n controller.methods.forEach((method) => {\n if (method.hidden) {\n return;\n }\n\n method.consumes = unique([...controller.consumes, ...method.consumes]);\n method.produces = unique([...controller.produces, ...method.produces]);\n method.tags = unique([...controller.tags, ...method.tags]);\n // Inherit controller security only when the method declared none of its own.\n // `[]` is truthy, so a plain `||` short-circuits and never cascades.\n if (!method.security?.length) {\n method.security = controller.security;\n }\n // OpenAPI has no controller-level `deprecated` — cascade\n // controller deprecation to every emitted operation.\n method.deprecated = method.deprecated || controller.deprecated;\n // todo: unique for objects\n method.responses = unique([...controller.responses, ...method.responses]);\n\n for (const controllerPath of controllerPaths) {\n const fullPath = normalizePathParameters(joinPaths(controllerPath, method.path));\n\n const pathItem = output[fullPath] ?? (output[fullPath] = {});\n pathItem[method.method] = this.buildMethod(method, fullPath, usedOperationIds);\n }\n });\n });\n\n return output;\n }\n\n private buildMethod(\n method: Method,\n emittedPath: string,\n usedOperationIds: Set<string>,\n ) : OperationV2 {\n const output = this.buildOperation(method);\n output.consumes = this.buildMethodConsumes(method);\n\n // Prefer an explicit operationId from metadata (matches V3 behaviour),\n // then disambiguate across multi-mount controllers (the same method\n // emitted at multiple paths must not share an operationId).\n const baseOperationId = method.operationId || output.operationId!;\n output.operationId = uniqueOperationId(baseOperationId, usedOperationIds);\n\n output.description = method.description;\n if (method.summary) {\n output.summary = method.summary;\n }\n\n if (method.deprecated) { output.deprecated = method.deprecated; }\n if (method.tags.length) { output.tags = method.tags; }\n if (method.security?.length) {\n output.security = method.security;\n }\n\n const parameters = this.groupParameters(method.parameters);\n\n // Filter path-bound params not present in this specific URL template.\n const pathParams = (parameters[ParameterSource.PATH] || [])\n .filter((p) => emittedPath.includes(`{${p.name}}`));\n\n output.parameters = [\n ...pathParams,\n ...(parameters[ParameterSource.QUERY_PROP] || []),\n ...(parameters[ParameterSource.HEADER] || []),\n ...(parameters[ParameterSource.FORM_DATA] || []),\n ].map((p) => this.buildParameter(p));\n\n // ignore ParameterSource.QUERY!\n\n // ------------------------------------------------------\n\n const bodyParameters = (parameters[ParameterSource.BODY] || []);\n if (bodyParameters.length > 1) {\n throw new SwaggerError({\n message: `Only one body parameter allowed per method, but ${bodyParameters.length} found in '${method.name}'.`,\n code: SwaggerErrorCode.BODY_PARAMETER_DUPLICATE,\n });\n }\n\n const bodyParameter = bodyParameters[0] ?\n this.buildParameter(bodyParameters[0]) :\n undefined;\n\n const bodyPropParams = parameters[ParameterSource.BODY_PROP] || [];\n if (bodyPropParams.length > 0) {\n const schema : BaseSchema<SchemaV2> = {\n type: DataTypeName.OBJECT,\n title: 'Body',\n properties: {},\n };\n\n const required : string[] = [];\n\n for (const bodyPropParam of bodyPropParams) {\n const bodyProp = this.getSchemaForType(bodyPropParam.type);\n bodyProp.default = bodyPropParam.default;\n bodyProp.description = bodyPropParam.description;\n bodyProp.example = bodyPropParam.examples;\n\n if (bodyProp.required) {\n required.push(bodyPropParam.name);\n }\n\n schema.properties![bodyPropParam.name] = bodyProp;\n }\n\n if (\n bodyParameter &&\n bodyParameter.in === ParameterSourceV2.BODY\n ) {\n if (bodyParameter.schema.type === DataTypeName.OBJECT) {\n bodyParameter.schema.properties = {\n ...(bodyParameter.schema.properties || {}),\n ...schema.properties,\n };\n\n bodyParameter.schema.required = [\n ...(bodyParameter.schema.required || []),\n ...required,\n ];\n } else {\n bodyParameter.schema = schema;\n }\n\n output.parameters.push(bodyParameter);\n } else {\n const parameter : ParameterV2 = {\n in: ParameterSourceV2.BODY,\n name: 'body',\n schema,\n };\n\n if (required.length) {\n parameter.schema.required = required;\n }\n\n output.parameters.push(parameter);\n }\n } else if (bodyParameter) {\n output.parameters.push(bodyParameter);\n }\n\n Object.assign(output, this.transformExtensions(method.extensions));\n\n return output;\n }\n\n private transformParameterSource(\n source: `${ParameterSource}`,\n ) : `${ParameterSourceV2}` | undefined {\n if (\n source === ParameterSource.BODY\n ) {\n return ParameterSourceV2.BODY;\n }\n\n if (source === ParameterSource.FORM_DATA) {\n return ParameterSourceV2.FORM_DATA;\n }\n\n if (source === ParameterSource.HEADER) {\n return ParameterSourceV2.HEADER;\n }\n\n if (source === ParameterSource.PATH) {\n return ParameterSourceV2.PATH;\n }\n\n if (source === ParameterSource.QUERY || source === ParameterSource.QUERY_PROP) {\n return ParameterSourceV2.QUERY;\n }\n\n return undefined;\n }\n\n protected buildParameter(input: Parameter): ParameterV2 {\n const sourceIn = this.transformParameterSource(input.in);\n if (!sourceIn) {\n throw new SwaggerError({\n message: `The parameter source '${input.in}' for parameter '${input.name}' is not supported in OpenAPI 2.0.`,\n code: SwaggerErrorCode.PARAMETER_SOURCE_UNSUPPORTED,\n });\n }\n\n const parameter = {\n description: input.description,\n in: sourceIn,\n name: input.name,\n required: input.required,\n } as ParameterV2;\n\n Object.assign(parameter, this.transformExtensions(input.extensions));\n\n if (\n input.in !== ParameterSource.BODY &&\n isRefEnumType(input.type)\n ) {\n input.type = {\n typeName: TypeName.ENUM,\n members: input.type.members,\n };\n }\n\n // Swagger 2.0: formData file parameters use type: 'file' directly\n if (\n parameter.in === ParameterSourceV2.FORM_DATA &&\n input.type.typeName === TypeName.FILE\n ) {\n parameter.type = 'file' as `${DataTypeName}`;\n Object.assign(parameter, this.transformValidators(input.validators));\n return parameter;\n }\n\n const parameterType = this.getSchemaForType(input.type);\n if (\n parameter.in !== ParameterSourceV2.BODY &&\n parameterType.format\n ) {\n parameter.format = parameterType.format;\n }\n\n // collectionFormat, might be valid for all parameters (if value != multi)\n if (\n (parameter.in === ParameterSourceV2.FORM_DATA || parameter.in === ParameterSourceV2.QUERY) &&\n (input.type.typeName === TypeName.ARRAY || parameterType.type === DataTypeName.ARRAY)\n ) {\n parameter.collectionFormat = input.collectionFormat || this.config.collectionFormat || 'multi';\n }\n\n if (parameter.in === ParameterSourceV2.BODY) {\n if ((input.type.typeName === TypeName.ARRAY || parameterType.type === DataTypeName.ARRAY)) {\n parameter.schema = {\n items: parameterType.items,\n type: DataTypeName.ARRAY,\n };\n } else if (input.type.typeName === TypeName.ANY) {\n parameter.schema = { type: DataTypeName.OBJECT };\n } else {\n parameter.schema = parameterType;\n }\n\n parameter.schema = {\n ...parameter.schema,\n ...this.transformValidators(input.validators),\n };\n\n return parameter;\n }\n\n // todo: this is eventually illegal\n Object.assign(parameter, this.transformValidators(input.validators));\n\n if (input.type.typeName === TypeName.ANY) {\n parameter.type = DataTypeName.STRING;\n } else if (parameterType.type && !Array.isArray(parameterType.type)) {\n parameter.type = parameterType.type;\n }\n\n if (parameterType.items) {\n parameter.items = parameterType.items;\n }\n if (parameterType.enum) {\n parameter.enum = parameterType.enum;\n }\n\n if (typeof input.default !== 'undefined') {\n parameter.default = input.default;\n }\n\n return parameter;\n }\n\n private buildMethodConsumes(method: Method) : string[] {\n if (\n method.consumes &&\n method.consumes.length > 0\n ) {\n return method.consumes;\n }\n\n if (this.hasFileParams(method)) {\n return ['multipart/form-data'];\n }\n\n if (this.hasFormParams(method)) {\n return ['application/x-www-form-urlencoded'];\n }\n\n if (this.supportsBodyParameters(method.method)) {\n return ['application/json'];\n }\n\n return [];\n }\n\n private hasFileParams(method: Method) {\n return method.parameters.some((p) => (p.in === ParameterSource.FORM_DATA && p.type.typeName === 'file'));\n }\n\n private hasFormParams(method: Method) {\n return method.parameters.some((p) => (p.in === ParameterSource.FORM_DATA));\n }\n\n private supportsBodyParameters(method: string) {\n return ['post', 'put', 'patch'].includes(method);\n }\n\n /*\n Swagger Type ( + utils)\n */\n\n protected applyNullable(schema: SchemaV2, nullable: boolean): void {\n schema['x-nullable'] = nullable;\n }\n\n protected getRefPrefix(): string {\n return '#/definitions/';\n }\n\n protected getSchemaForIntersectionType(type: IntersectionType) : SchemaV2 {\n // tslint:disable-next-line:no-shadowed-variable\n const properties = type.members.reduce((acc, type) => {\n if (isRefObjectType(type)) {\n const refType = this.metadata.referenceTypes[type.refName] as RefObjectType;\n\n const props = refType &&\n refType.properties &&\n refType.properties.reduce((pAcc, prop) => ({\n ...pAcc,\n [prop.name]: this.getSchemaForType(prop.type),\n }), {});\n return { ...acc, ...props };\n }\n return { ...acc };\n }, {});\n\n return { type: DataTypeName.OBJECT, properties };\n }\n\n\n protected getSchemaForUnionType(type: UnionType) : SchemaV2 {\n const members : Type[] = [];\n\n const enumTypeMember : EnumType = { typeName: TypeName.ENUM, members: [] };\n for (const member of type.members) {\n if (isEnumType(member)) {\n enumTypeMember.members.push(...member.members);\n }\n\n if (\n !isAnyType(member) &&\n !isUndefinedType(member) &&\n !isNeverType(member) &&\n !isEnumType(member)\n ) {\n members.push(member);\n }\n }\n\n if (\n members.length === 0 &&\n enumTypeMember.members.length > 0\n ) {\n return this.getSchemaForEnumType(enumTypeMember);\n }\n\n const isNullEnum = enumTypeMember.members.every((member) => member === null);\n if (members.length === 1) {\n const single = members[0]!;\n if (isNullEnum) {\n const memberType = this.getSchemaForType(single) as SchemaV2;\n if (memberType.$ref) {\n return memberType;\n }\n\n memberType['x-nullable'] = true;\n return memberType;\n }\n\n if (enumTypeMember.members.length === 0) {\n return this.getSchemaForType(single);\n }\n }\n\n return { type: DataTypeName.OBJECT, ...(isNullEnum ? { 'x-nullable': true } : {}) };\n }\n\n private buildOperation(method: Method) {\n const operation : OperationV2 = {\n operationId: this.getOperationId(method.name),\n consumes: method.consumes || [],\n produces: method.produces || [],\n responses: {},\n };\n\n const produces : string[] = [];\n\n method.responses.forEach((res: Response) => {\n operation.responses[res.status] = { description: res.description };\n\n if (\n res.schema &&\n !isVoidType(res.schema) &&\n !isNeverType(res.schema)\n ) {\n if (res.produces) {\n produces.push(...res.produces);\n } else if (isBinaryType(res.schema)) {\n produces.push('application/octet-stream');\n }\n\n operation.responses[res.status]!.schema = this.getSchemaForType(res.schema);\n }\n\n const example = res.examples?.[0];\n if (example?.value) {\n operation.responses[res.status]!.examples = { 'application/json': example.value };\n }\n });\n\n const consumes = operation.consumes!;\n if (consumes.length === 0) {\n const hasBody = method.parameters\n .some((parameter) => parameter.in === ParameterSource.BODY || parameter.in === ParameterSource.BODY_PROP);\n if (hasBody) {\n consumes.push('application/json');\n }\n\n const hasFormData = method.parameters\n .some((parameter) => parameter.in === ParameterSource.FORM_DATA);\n if (hasFormData) {\n consumes.push('multipart/form-data');\n }\n }\n\n if (\n operation.produces!.length === 0 &&\n produces.length > 0\n ) {\n operation.produces = [...new Set(produces)];\n }\n\n if (operation.produces!.length === 0) {\n operation.produces = ['application/json'];\n }\n\n return operation;\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n BaseType,\n EnumType,\n IntersectionType,\n Metadata,\n Method,\n NestedObjectLiteralType,\n Parameter,\n RefAliasType,\n RefEnumType,\n RefObjectType,\n ResolverProperty,\n Response,\n Type, \n UnionType, \n} from '@trapi/core';\nimport {\n ParameterSource,\n TypeName,\n isAnyType,\n isEnumType,\n isIntersectionType,\n isNestedObjectLiteralType,\n isNeverType,\n isRefAliasType,\n isRefObjectType,\n isUndefinedType,\n isVoidType,\n} from '@trapi/core';\nimport { URL } from 'node:url';\nimport { merge } from 'smob';\nimport type {\n Example,\n HeaderV3,\n MediaTypeV3,\n OperationV3,\n ParameterV3,\n Path,\n RequestBodyV3,\n ResponseV3,\n SchemaV3,\n SecurityV3,\n ServerV3,\n SpecV3,\n} from '../../../core/schema';\nimport {\n DataTypeName,\n ParameterSourceV3,\n} from '../../../core/schema';\nimport type { SpecGeneratorOptionsInput } from '../../../core/config';\nimport type { SecurityDefinitions } from '../../../core/types';\nimport { SwaggerError, SwaggerErrorCode } from '../../../core/error';\nimport {\n joinPaths,\n normalizePathParameters,\n} from '../../../core/utils';\nimport { AbstractSpecGenerator } from '../abstract';\nimport type { Version } from '../../../core/constants';\n\nconst OPENAPI_VERSION_MAP: Partial<Record<`${Version}`, string>> = {\n v3: '3.0.0',\n 'v3.1': '3.1.0',\n 'v3.2': '3.2.0',\n};\n\nfunction uniqueOperationId(base: string, used: Set<string>): string {\n if (!used.has(base)) {\n used.add(base);\n return base;\n }\n let counter = 2;\n while (used.has(`${base}_${counter}`)) {\n counter += 1;\n }\n const candidate = `${base}_${counter}`;\n used.add(candidate);\n return candidate;\n}\n\nexport class V3Generator extends AbstractSpecGenerator<SpecV3, SchemaV3> {\n private readonly openApiVersion: string;\n\n constructor(\n metadata: Metadata,\n config: SpecGeneratorOptionsInput,\n version: `${Version}` = 'v3.2',\n ) {\n super(metadata, config);\n this.openApiVersion = OPENAPI_VERSION_MAP[version] || '3.2.0';\n }\n\n async build() : Promise<SpecV3> {\n if (typeof this.spec !== 'undefined') {\n return this.spec;\n }\n\n let spec: SpecV3 = {\n components: this.buildComponents(),\n info: this.buildInfo(),\n openapi: this.openApiVersion,\n paths: this.buildPaths(),\n servers: this.buildServers(),\n tags: this.buildTags(),\n };\n\n if (this.config.specificationExtra) {\n spec = merge(spec, this.config.specificationExtra);\n }\n\n this.spec = spec;\n\n return spec;\n }\n\n private buildComponents() {\n const components = {\n examples: {},\n headers: {},\n parameters: {},\n requestBodies: {},\n responses: {},\n schemas: this.buildSchemasForReferenceTypes((output, referenceType) => {\n if (referenceType.deprecated) {\n output.deprecated = true;\n }\n }),\n securitySchemes: {},\n };\n\n if (this.config.securityDefinitions) {\n components.securitySchemes = V3Generator.translateSecurityDefinitions(this.config.securityDefinitions);\n }\n\n return components;\n }\n\n private static translateSecurityDefinitions(\n securityDefinitions: SecurityDefinitions,\n ) : Record<string, SecurityV3> {\n const output : Record<string, SecurityV3> = {};\n\n for (const [key, securityDefinition] of Object.entries(securityDefinitions)) {\n switch (securityDefinition.type) {\n case 'http':\n output[key] = securityDefinition;\n break;\n case 'oauth2':\n output[key] = securityDefinition;\n break;\n case 'apiKey':\n output[key] = securityDefinition;\n break;\n }\n }\n\n return output;\n }\n\n private buildPaths() {\n const output: Record<string, Path<OperationV3, ParameterV3>> = {};\n const usedOperationIds = new Set<string>();\n\n for (const controller of this.metadata.controllers) {\n if (controller.hidden) {\n continue;\n }\n\n const controllerPaths = controller.paths.length === 0 ? [''] : controller.paths;\n\n for (const method of controller.methods) {\n if (method.hidden) {\n continue;\n }\n\n // OpenAPI has no controller-level `deprecated` — cascade\n // controller deprecation to every emitted operation.\n method.deprecated = method.deprecated || controller.deprecated;\n\n // Inherit controller security only when the method declared none of its own.\n // OpenAPI 3.x: an operation's `security: []` explicitly removes any inherited\n // requirement, so we must omit the field when the method has no security\n // rather than emitting an empty array.\n if (!method.security?.length) {\n method.security = controller.security;\n }\n\n for (const controllerPath of controllerPaths) {\n const path = normalizePathParameters(joinPaths(controllerPath, method.path));\n\n const pathItem = output[path] ?? (output[path] = {});\n pathItem[method.method] = this.buildMethod(controller.name, method, path, usedOperationIds);\n }\n }\n }\n\n return output;\n }\n\n private buildMethod(\n controllerName: string,\n method: Method,\n emittedPath: string,\n usedOperationIds: Set<string>,\n ) : OperationV3 {\n const output = this.buildOperation(controllerName, method);\n\n output.description = method.description;\n output.summary = method.summary;\n output.tags = method.tags;\n\n // Use the explicit operationId tag if provided, otherwise the generated\n // one. When the same method is mounted at multiple controller paths the\n // operationIds collide — disambiguate by suffixing _2, _3, ... so the\n // emitted spec stays OpenAPI-valid.\n const baseOperationId = method.operationId || output.operationId!;\n output.operationId = uniqueOperationId(baseOperationId, usedOperationIds);\n\n if (method.deprecated) {\n output.deprecated = method.deprecated;\n }\n\n if (method.security?.length) {\n output.security = method.security as any[];\n }\n\n const parameters = this.groupParameters(method.parameters);\n\n // Path parameters declared on the method may not all appear in every\n // controller mount (e.g. /roles vs /realms/:id/roles). Only emit\n // path-bound params that are present in `emittedPath`.\n const pathParams = (parameters[ParameterSource.PATH] || [])\n .filter((p) => emittedPath.includes(`{${p.name}}`));\n\n output.parameters = [\n ...(parameters[ParameterSource.QUERY_PROP] || []),\n ...(parameters[ParameterSource.HEADER] || []),\n ...pathParams,\n ...(parameters[ParameterSource.COOKIE] || []),\n ]\n .map((p) => this.buildParameter(p));\n\n // ignore ParameterSource.QUERY!\n\n const bodyParams = parameters[ParameterSource.BODY] || [];\n const formParams = parameters[ParameterSource.FORM_DATA] || [];\n\n if (bodyParams.length > 1) {\n throw new SwaggerError({\n message: `Only one body parameter allowed per method, but ${bodyParams.length} found in '${method.name}'.`,\n code: SwaggerErrorCode.BODY_PARAMETER_DUPLICATE,\n });\n }\n\n if (bodyParams.length > 0 && formParams.length > 0) {\n throw new SwaggerError({\n message: `Cannot mix body and form parameters in method '${method.name}'.`,\n code: SwaggerErrorCode.BODY_FORM_CONFLICT,\n });\n }\n\n const bodyPropParams = parameters[ParameterSource.BODY_PROP] || [];\n const firstBodyProp = bodyPropParams[0];\n if (firstBodyProp) {\n if (bodyParams.length === 0) {\n bodyParams.push({\n in: ParameterSource.BODY,\n name: 'body',\n description: '',\n parameterName: firstBodyProp.parameterName || 'body',\n required: true,\n type: {\n typeName: TypeName.NESTED_OBJECT_LITERAL,\n properties: [],\n },\n validators: {},\n deprecated: false,\n extensions: [],\n });\n }\n\n const firstBody = bodyParams[0]!;\n if (isNestedObjectLiteralType(firstBody.type)) {\n for (const bodyPropParam of bodyPropParams) {\n firstBody.type.properties.push({\n default: bodyPropParam.default,\n validators: bodyPropParam.validators,\n description: bodyPropParam.description,\n name: bodyPropParam.name,\n type: bodyPropParam.type,\n required: bodyPropParam.required,\n deprecated: bodyPropParam.deprecated ?? false,\n });\n }\n }\n }\n\n const firstBodyParam = bodyParams[0];\n if (firstBodyParam) {\n output.requestBody = this.buildRequestBody(firstBodyParam);\n } else if (formParams.length > 0) {\n output.requestBody = this.buildRequestBodyWithFormData(formParams);\n }\n\n Object.assign(output, this.transformExtensions(method.extensions));\n\n return output;\n }\n\n private buildRequestBodyWithFormData(parameters: Parameter[]): RequestBodyV3 {\n const required: string[] = [];\n const properties: Record<string, SchemaV3> = {};\n\n for (const parameter of parameters) {\n properties[parameter.name] = this.buildMediaType(parameter).schema!;\n\n if (parameter.required) {\n required.push(parameter.name);\n }\n }\n\n return {\n required: required.length > 0,\n content: {\n 'multipart/form-data': {\n schema: {\n type: DataTypeName.OBJECT,\n properties,\n // An empty list required: [] is not valid.\n // If all properties are optional, do not specify the required keyword.\n ...(required && required.length && { required }),\n },\n },\n },\n };\n }\n\n private buildRequestBody(parameter: Parameter): RequestBodyV3 {\n const mediaType = this.buildMediaType(parameter);\n\n return {\n description: parameter.description,\n required: parameter.required,\n content: { 'application/json': mediaType },\n };\n }\n\n private buildMediaType(parameter: Parameter): MediaTypeV3 {\n const examples = this.transformParameterExamples(parameter);\n return {\n schema: this.getSchemaForType(parameter.type),\n ...(Object.keys(examples).length > 0 && { examples }),\n };\n }\n\n protected buildResponses(input: Response[]) : Record<string, ResponseV3> {\n const output: Record<string, ResponseV3> = {};\n\n for (const res of input) {\n const name : string = res.status || 'default';\n const response: ResponseV3 = { description: res.description };\n output[name] = response;\n\n if (\n res.schema &&\n !isVoidType(res.schema) &&\n !isNeverType(res.schema)\n ) {\n const examples : Record<string, Example> = {};\n if (res.examples) {\n for (const [i, ex] of res.examples.entries()) {\n const label = ex.label || `example${i + 1}`;\n examples[label] = { value: ex.value };\n }\n }\n\n const content = response.content ?? (response.content = {});\n\n const contentTypes = res.produces || ['application/json'];\n for (const contentType of contentTypes) {\n content[contentType] = {\n schema: this.getSchemaForType(res.schema),\n ...(Object.keys(examples).length > 0 && { examples }),\n };\n }\n }\n\n if (res.headers) {\n const headers: Record<string, HeaderV3> = {};\n if (isRefObjectType(res.headers)) {\n headers[res.headers.refName] = {\n schema: this.getSchemaForReferenceType(res.headers) as SchemaV3,\n description: res.headers.description,\n };\n } else if (isNestedObjectLiteralType(res.headers)) {\n res.headers.properties.forEach((each: ResolverProperty) => {\n headers[each.name] = {\n schema: this.getSchemaForType(each.type) as SchemaV3,\n description: each.description,\n required: each.required,\n };\n });\n }\n\n response.headers = headers;\n }\n }\n\n return output;\n }\n\n protected buildOperation(_controllerName: string, method: Method): OperationV3 {\n const operation : OperationV3 = {\n operationId: this.getOperationId(method.name),\n responses: this.buildResponses(method.responses),\n };\n if (method.description) {\n operation.description = method.description;\n }\n if (method.security?.length) {\n operation.security = method.security;\n }\n if (method.deprecated) {\n operation.deprecated = method.deprecated;\n }\n\n return operation;\n }\n\n protected transformParameterSource(\n source: `${ParameterSource}`,\n ) : `${ParameterSourceV3}` | undefined {\n if (source === ParameterSource.COOKIE) {\n return ParameterSourceV3.COOKIE;\n }\n\n if (source === ParameterSource.HEADER) {\n return ParameterSourceV3.HEADER;\n }\n\n if (source === ParameterSource.PATH) {\n return ParameterSourceV3.PATH;\n }\n\n if (source === ParameterSource.QUERY_PROP || source === ParameterSource.QUERY) {\n return ParameterSourceV3.QUERY;\n }\n\n return undefined;\n }\n\n protected buildParameter(input: Parameter): ParameterV3 {\n const sourceIn = this.transformParameterSource(input.in);\n if (!sourceIn) {\n throw new SwaggerError({\n message: `The parameter source '${input.in}' for parameter '${input.name}' is not supported in OpenAPI 3.x.`,\n code: SwaggerErrorCode.PARAMETER_SOURCE_UNSUPPORTED,\n });\n }\n\n const parameter : ParameterV3 = {\n allowEmptyValue: false,\n deprecated: false,\n description: input.description,\n in: sourceIn,\n name: input.name,\n required: input.required,\n schema: {\n default: input.default,\n format: undefined,\n ...this.transformValidators(input.validators),\n },\n };\n\n Object.assign(parameter, this.transformExtensions(input.extensions));\n\n if (input.deprecated) {\n parameter.deprecated = true;\n }\n\n const parameterType = this.getSchemaForType(input.type);\n const schema = parameter.schema!;\n if (parameterType.format) {\n schema.format = parameterType.format;\n }\n\n if (parameterType.$ref) {\n parameter.schema = parameterType;\n return parameter;\n }\n\n if (isAnyType(input.type)) {\n schema.type = DataTypeName.STRING;\n } else {\n if (parameterType.type) {\n schema.type = parameterType.type as DataTypeName;\n }\n schema.items = parameterType.items;\n schema.enum = parameterType.enum;\n }\n\n parameter.examples = this.transformParameterExamples(input);\n\n return parameter;\n }\n\n private transformParameterExamples(parameter: Parameter) : Record<string, Example> {\n const output : Record<string, Example> = {};\n if (parameter.examples) {\n for (const [i, ex] of parameter.examples.entries()) {\n const label = ex.label || `example${i + 1}`;\n output[label] = { value: ex.value };\n }\n }\n\n return output;\n }\n\n private buildServers() : ServerV3[] {\n const servers: ServerV3[] = [];\n const configured = this.config.servers ?? [];\n for (const entry of configured) {\n const url = new URL(entry.url, 'http://localhost:3000/');\n servers.push({\n url: `${url.protocol}//${url.host}${url.pathname || ''}`,\n ...(entry.description ? { description: entry.description } : {}),\n });\n }\n\n return servers;\n }\n\n protected resolveAdditionalProperties(type: BaseType): SchemaV3 {\n return this.getSchemaForType(type) as SchemaV3;\n }\n\n protected markPropertyDeprecated(schema: SchemaV3): void {\n schema.deprecated = true;\n }\n\n protected override assignPropertyDefaults(schema: SchemaV3, property: ResolverProperty): void {\n schema.default = property.default;\n }\n\n protected override buildSchemaForRefEnum(referenceType: RefEnumType): SchemaV3 {\n const typesUsed = this.determineTypesUsedInEnum(referenceType.members);\n\n // Single-type enums use the shared base implementation\n if (typesUsed.length === 1) {\n return super.buildSchemaForRefEnum(referenceType) as SchemaV3;\n }\n\n // Multi-type enums use anyOf with per-type sub-schemas (V3 only)\n const schema: SchemaV3 = {\n description: referenceType.description,\n anyOf: [],\n };\n\n for (const element of typesUsed) {\n schema.anyOf!.push({\n type: element as `${DataTypeName}`,\n enum: referenceType.members.filter((e) => typeof e === element),\n });\n }\n\n return schema;\n }\n\n private isV31OrLater(): boolean {\n return !this.openApiVersion.startsWith('3.0');\n }\n\n protected override shouldStripRefSiblings(): boolean {\n return !this.isV31OrLater();\n }\n\n protected getSchemaForIntersectionType(type: IntersectionType) : SchemaV3 {\n return { allOf: type.members.map((x: Type) => this.getSchemaForType(x)) };\n }\n\n protected applyNullable(schema: SchemaV3, nullable: boolean): void {\n if (!nullable) {\n return;\n }\n\n if (this.isV31OrLater()) {\n // 3.1+: use type arrays instead of nullable keyword\n if (schema.type && !Array.isArray(schema.type)) {\n schema.type = [schema.type, 'null'];\n } else if (Array.isArray(schema.type) && !schema.type.includes('null')) {\n schema.type = [...schema.type, 'null'];\n }\n } else {\n // 3.0: use nullable keyword\n schema.nullable = true;\n }\n }\n\n protected getRefPrefix(): string {\n return '#/components/schemas/';\n }\n\n protected getSchemaForUnionType(type: UnionType) : SchemaV3 {\n const members : Type[] = [];\n\n let nullable = false;\n const enumMembers : Record<string, Array<string | number | boolean>> = {};\n for (const member of type.members) {\n if (isEnumType(member)) {\n for (const memberChild of member.members) {\n if (memberChild === null || memberChild === undefined) {\n nullable = true;\n continue;\n }\n\n const typeOf = typeof memberChild;\n if (typeOf === 'string' || typeOf === 'number' || typeOf === 'boolean') {\n const bucket = enumMembers[typeOf] ?? (enumMembers[typeOf] = []);\n bucket.push(memberChild);\n }\n }\n }\n\n if (\n !isAnyType(member) &&\n !isUndefinedType(member) &&\n !isNeverType(member) &&\n !isEnumType(member)\n ) {\n members.push(member);\n }\n }\n\n const schemas : SchemaV3[] = [];\n for (const member of members) {\n schemas.push(this.getSchemaForType(member));\n }\n\n const enumMembersKeys = Object.keys(enumMembers);\n for (const enumMembersKey of enumMembersKeys) {\n const enumType : EnumType = {\n typeName: 'enum',\n members: enumMembers[enumMembersKey]!,\n };\n schemas.push(this.getSchemaForEnumType(enumType));\n }\n\n // Use oneOf when all non-enum members are object-like types\n const useOneOf = members.length > 0 &&\n enumMembersKeys.length === 0 &&\n members.every((m) => V3Generator.isObjectLikeType(m));\n\n const compositionKey = useOneOf ? 'oneOf' : 'anyOf';\n\n if (this.isV31OrLater()) {\n if (nullable) {\n schemas.push({ type: 'null' } as unknown as SchemaV3);\n }\n\n if (schemas.length === 1) {\n return schemas[0]!;\n }\n\n const schema: SchemaV3 = { [compositionKey]: schemas };\n if (useOneOf) {\n this.applyDiscriminator(schema, members);\n }\n return schema;\n }\n\n // 3.0: use nullable keyword\n if (schemas.length === 1) {\n const schema = schemas[0]!;\n\n if (schema.$ref) {\n return { allOf: [schema], nullable };\n }\n\n return { ...schema, nullable };\n }\n\n const schema: SchemaV3 = {\n [compositionKey]: schemas,\n ...(nullable ? { nullable } : {}),\n };\n if (useOneOf) {\n this.applyDiscriminator(schema, members);\n }\n return schema;\n }\n\n private static isObjectLikeType(type: Type): boolean {\n if (isRefObjectType(type) ||\n isNestedObjectLiteralType(type) ||\n isIntersectionType(type)) {\n return true;\n }\n\n // Unwrap refAlias to check the underlying type — a refAlias\n // wrapping a primitive (e.g. `type Id = string`) is not object-like.\n if (isRefAliasType(type)) {\n return V3Generator.isObjectLikeType(type.type);\n }\n\n return false;\n }\n\n private applyDiscriminator(schema: SchemaV3, members: Type[]): void {\n const discriminator = this.detectDiscriminator(members);\n if (discriminator) {\n schema.discriminator = discriminator;\n }\n }\n\n private detectDiscriminator(\n members: Type[],\n ): { propertyName: string; mapping: Record<string, string> } | undefined {\n // Resolve each member to { refName, properties }. Supports both\n // refObject and refAlias members (#783).\n const resolvedMembers = members.map((m) => this.resolveDiscriminatorMember(m));\n if (resolvedMembers.some((m) => !m)) {\n return undefined;\n }\n\n // Find a common property with distinct enum literal values in each member\n const firstProps = resolvedMembers[0]!.properties;\n for (const prop of firstProps) {\n if (prop.type.typeName !== 'enum') continue;\n const enumType = prop.type as EnumType;\n if (enumType.members.length !== 1) continue;\n\n const propName = prop.name;\n const mapping: Record<string, string> = {};\n let isDiscriminator = true;\n\n for (const member of resolvedMembers) {\n const memberProp = member!.properties.find((p) => p.name === propName);\n if (\n !memberProp ||\n !memberProp.required ||\n memberProp.type.typeName !== 'enum' ||\n (memberProp.type as EnumType).members.length !== 1\n ) {\n isDiscriminator = false;\n break;\n }\n\n const value = String((memberProp.type as EnumType).members[0]);\n if (mapping[value]) {\n isDiscriminator = false;\n break;\n }\n mapping[value] = `${this.getRefPrefix()}${member!.refName}`;\n }\n\n if (isDiscriminator && Object.keys(mapping).length === members.length) {\n return { propertyName: propName, mapping };\n }\n }\n\n return undefined;\n }\n\n /**\n * Resolve a union member to its refName and properties for discriminator\n * detection. Accepts both refObject and refAlias members, unwrapping\n * aliases to find the underlying properties while preserving the\n * original refName for $ref mapping.\n */\n private resolveDiscriminatorMember(\n member: Type,\n ): { refName: string; properties: ResolverProperty[] } | undefined {\n if (!isRefObjectType(member) && !isRefAliasType(member)) {\n return undefined;\n }\n\n const { refName } = member as RefObjectType | RefAliasType;\n const referenceType = this.metadata.referenceTypes[refName];\n if (!referenceType) {\n return undefined;\n }\n\n if (referenceType.typeName === 'refObject') {\n return { refName, properties: (referenceType as RefObjectType).properties };\n }\n\n if (referenceType.typeName === 'refAlias') {\n let inner: Type = (referenceType as RefAliasType).type;\n for (let depth = 0; depth < 10; depth++) {\n if (isRefObjectType(inner)) {\n const resolved = this.metadata.referenceTypes[inner.refName];\n if (resolved?.typeName === 'refObject') {\n return { refName, properties: (resolved as RefObjectType).properties };\n }\n return undefined;\n }\n if (isNestedObjectLiteralType(inner)) {\n return { refName, properties: (inner as NestedObjectLiteralType).properties };\n }\n if (isRefAliasType(inner)) {\n inner = (inner as RefAliasType).type;\n continue;\n }\n return undefined;\n }\n }\n\n return undefined;\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isMetadata } from '@trapi/core';\nimport type { SpecGeneratorOptionsInput, SwaggerGenerateOptions } from '../core/config';\nimport { Version } from '../core/constants';\nimport { SwaggerError } from '../core/error/module';\nimport { SwaggerErrorCode } from '../core/error/codes';\nimport type { OutputForVersion } from '../core/types';\nimport { V2Generator, V3Generator } from '../adapters/index.ts';\n\nfunction toSpecGeneratorOptionsInput(options: SwaggerGenerateOptions): SpecGeneratorOptionsInput {\n const { data } = options;\n\n if (!data) {\n return {};\n }\n\n return {\n name: data.name,\n version: data.version,\n description: data.description,\n license: data.license,\n servers: data.servers,\n securityDefinitions: data.securityDefinitions,\n consumes: data.consumes,\n produces: data.produces,\n collectionFormat: data.collectionFormat,\n specificationExtra: data.extra,\n };\n}\n\nexport async function generateSwagger<V extends `${Version}`>(\n options: Omit<SwaggerGenerateOptions, 'version'> & { version: V },\n): Promise<OutputForVersion<V>> {\n const { metadata } = options;\n if (!isMetadata(metadata)) {\n throw new SwaggerError({\n message: 'Expected `options.metadata` to be a pre-built Metadata object ({ controllers, referenceTypes }). Run `generateMetadata` from `@trapi/metadata` first, or supply your own Metadata-shaped value.',\n code: SwaggerErrorCode.METADATA_INVALID,\n });\n }\n const specGeneratorOptionsInput = toSpecGeneratorOptionsInput(options);\n\n switch (options.version) {\n case Version.V3:\n case Version.V3_1:\n case Version.V3_2: {\n const generator = new V3Generator(metadata, specGeneratorOptionsInput, options.version);\n\n return await generator.build() as OutputForVersion<V>;\n }\n default: {\n const generator = new V2Generator(metadata, specGeneratorOptionsInput);\n\n return await generator.build() as OutputForVersion<V>;\n }\n }\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport process from 'node:process';\nimport YAML from 'yamljs';\nimport type { SwaggerSaveOptions } from '../core/config';\nimport { DocumentFormat } from '../core/constants';\nimport type { SpecV2, SpecV3 } from '../core/schema';\nimport type { DocumentFormatData } from '../core/types';\n\nconst EXTENSION_PATTERN = /\\.(json|ya?ml)$/i;\n\nfunction resolveFileName(name: string | undefined, format: `${DocumentFormat}`): string {\n const base = (name ?? 'swagger').replace(EXTENSION_PATTERN, '');\n return `${base}.${format}`;\n}\n\nfunction serialise(spec: SpecV2 | SpecV3, format: `${DocumentFormat}`): string {\n if (format === DocumentFormat.YAML) {\n return YAML.stringify(spec, 1000);\n }\n return JSON.stringify(spec, null, 4);\n}\n\nexport async function saveSwagger(\n spec: SpecV2 | SpecV3,\n options: SwaggerSaveOptions = {},\n): Promise<DocumentFormatData> {\n const format: `${DocumentFormat}` = options.format ?? DocumentFormat.JSON;\n\n let cwd = process.cwd();\n if (options.cwd) {\n cwd = path.isAbsolute(options.cwd) ? options.cwd : path.join(process.cwd(), options.cwd);\n }\n\n const name = resolveFileName(options.name, format);\n const filePath = path.join(cwd, name);\n\n await fs.promises.mkdir(cwd, { recursive: true });\n\n const content = serialise(spec, format);\n await fs.promises.writeFile(filePath, content, { encoding: 'utf-8' });\n\n return {\n path: filePath,\n name,\n content,\n };\n}\n"],"mappings":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,IAAI,QAAQ,MAAM,KAAK,KAAK,QAAQ,IAAI,GAAG,QAAQ,GAAG;CAG3F,MAAM,OAAO,gBAAgB,QAAQ,MAAM,MAAM;CACjD,MAAM,WAAW,KAAK,KAAK,KAAK,IAAI;CAEpC,MAAM,GAAG,SAAS,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;CAEhD,MAAM,UAAU,UAAU,MAAM,MAAM;CACtC,MAAM,GAAG,SAAS,UAAU,UAAU,SAAS,EAAE,UAAU,QAAQ,CAAC;CAEpE,OAAO;EACH,MAAM;EACN;EACA;CACJ;AACJ"}
1
+ {"version":3,"file":"index.mjs","names":["uniqueOperationId"],"sources":["../src/core/config/utils.ts","../src/core/constants.ts","../src/core/error/codes.ts","../src/core/error/module.ts","../src/core/schema/v2/constants.ts","../src/core/schema/v3/constants.ts","../src/core/schema/constants.ts","../src/core/utils/character.ts","../src/core/utils/path.ts","../src/core/utils/object.ts","../src/core/utils/value.ts","../src/adapters/generator/abstract.ts","../src/adapters/generator/v2/module.ts","../src/adapters/generator/v3/module.ts","../src/app/module.ts","../src/app/save.ts"],"sourcesContent":["/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { ServerOption, SpecGeneratorOptions, SpecGeneratorOptionsInput } from './types';\n\nexport function buildSpecGeneratorOptions(input: SpecGeneratorOptionsInput) : SpecGeneratorOptions {\n const servers : ServerOption[] = [];\n if (input.servers) {\n if (Array.isArray(input.servers)) {\n for (const server of input.servers) {\n if (typeof server === 'string') {\n servers.push({ url: server });\n } else {\n servers.push(server);\n }\n }\n } else if (typeof input.servers === 'string') {\n servers.push({ url: input.servers });\n } else {\n servers.push(input.servers);\n }\n }\n\n return {\n ...input,\n servers,\n };\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const Version = {\n V2: 'v2',\n V3: 'v3',\n V3_1: 'v3.1',\n V3_2: 'v3.2',\n} as const;\nexport type Version = typeof Version[keyof typeof Version];\n\nexport const DocumentFormat = {\n YAML: 'yaml',\n JSON: 'json',\n} as const;\nexport type DocumentFormat = typeof DocumentFormat[keyof typeof DocumentFormat];\n\nexport const SecurityType = {\n API_KEY: 'apiKey',\n BASIC: 'basic', // v2 only\n HTTP: 'http',\n OAUTH2: 'oauth2',\n} as const;\nexport type SecurityType = typeof SecurityType[keyof typeof SecurityType];\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const SwaggerErrorCode = {\n SPEC_NOT_BUILT: 'SWAGGER_SPEC_NOT_BUILT',\n ENUM_UNSUPPORTED_TYPE: 'SWAGGER_ENUM_UNSUPPORTED_TYPE',\n BODY_PARAMETER_DUPLICATE: 'SWAGGER_BODY_PARAMETER_DUPLICATE',\n BODY_FORM_CONFLICT: 'SWAGGER_BODY_FORM_CONFLICT',\n PARAMETER_SOURCE_UNSUPPORTED: 'SWAGGER_PARAMETER_SOURCE_UNSUPPORTED',\n METADATA_INVALID: 'SWAGGER_METADATA_INVALID',\n} as const;\n","/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { BaseError } from '@ebec/core';\n\nexport class SwaggerError extends BaseError {\n\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ParameterSourceV2 = {\n BODY: 'body',\n FORM_DATA: 'formData',\n HEADER: 'header',\n PATH: 'path',\n QUERY: 'query',\n} as const;\nexport type ParameterSourceV2 = typeof ParameterSourceV2[keyof typeof ParameterSourceV2];\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const ParameterSourceV3 = {\n COOKIE: 'cookie',\n HEADER: 'header',\n PATH: 'path',\n QUERY: 'query',\n} as const;\nexport type ParameterSourceV3 = typeof ParameterSourceV3[keyof typeof ParameterSourceV3];\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport const TransferProtocol = {\n HTTP: 'http',\n HTTPS: 'https',\n WS: 'ws',\n WSS: 'wss',\n} as const;\nexport type TransferProtocol = typeof TransferProtocol[keyof typeof TransferProtocol];\n\nexport const DataFormatName = {\n INT_32: 'int32',\n INT_64: 'int64',\n FLOAT: 'float',\n DOUBLE: 'double',\n BYTE: 'byte',\n BINARY: 'binary',\n DATE: 'date',\n DATE_TIME: 'date-time',\n PASSWORD: 'password',\n} as const;\nexport type DataFormatName = typeof DataFormatName[keyof typeof DataFormatName];\n\nexport const DataTypeName = {\n VOID: 'void',\n INTEGER: 'integer',\n NUMBER: 'number',\n BOOLEAN: 'boolean',\n STRING: 'string',\n ARRAY: 'array',\n OBJECT: 'object',\n FILE: 'file',\n} as const;\nexport type DataTypeName = typeof DataTypeName[keyof typeof DataTypeName];\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function removeDuplicateSlashes(str: string) : string {\n // URL-safe: a `:/` boundary (e.g. `http://`) is not collapsed.\n return str.replace(/([^:]\\/)\\/+/g, '$1');\n}\n\nexport function removeFinalCharacter(\n str: string,\n character: string,\n) {\n while (str.charAt(str.length - 1) === character && str.length > 0) {\n str = str.slice(0, -1);\n }\n\n return str;\n}\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function normalizePathParameters(str: string) : string {\n // <:id> -> {id}\n // todo: maybe escaping / is necessary\n str = str.replace(/<:([^/]+)>/g, '{$1}');\n\n // :id -> {id}\n str = str.replace(/:([^/]+)/g, '{$1}');\n\n // <id> -> {id}\n str = str.replace(/<([^/]+)>/g, '{$1}');\n\n return str;\n}\n\n// OpenAPI 3.x §4.8.8 requires every `paths` key to start with `/`. Joining a\n// controller path with a method path naively (template literal + slash\n// stripping) collapses the root combination — `''` + `'/'`, `'/'` + `''`,\n// `'/'` + `'/'` — to an empty string, which strict validators reject.\nexport function joinPaths(...segments: string[]): string {\n let result = segments.join('/').replace(/\\/{2,}/g, '/');\n if (!result.startsWith('/')) {\n result = `/${result}`;\n }\n if (result.length > 1 && result.endsWith('/')) {\n result = result.slice(0, -1);\n }\n return result;\n}\n","/*\n * Copyright (c) 2021-2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function hasOwnProperty<X extends object, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown> {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n","/*\n * Copyright (c) 2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nexport function transformValueTo(\n type: 'string' | 'number' | 'integer' | 'boolean' | 'bigint',\n value: unknown,\n): string | number | boolean | null {\n if (value === null) {\n return null;\n }\n\n switch (type) {\n case 'integer':\n case 'number':\n return Number(value);\n case 'boolean':\n return !!value;\n case 'string':\n default:\n return String(value);\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n ArrayType,\n BaseType,\n EnumType,\n Extension,\n IntersectionType,\n Metadata,\n NestedObjectLiteralType,\n Parameter,\n ParameterSource,\n PrimitiveType,\n RefAliasType,\n RefEnumType,\n RefObjectType,\n ReferenceType,\n ResolverProperty,\n TupleType,\n UnionType,\n Validators, \n VariableType, \n} from '@trapi/core';\nimport {\n TypeName,\n isArrayType,\n isEnumType,\n isIntersectionType,\n isNestedObjectLiteralType,\n isNeverType,\n isPrimitiveType,\n isReferenceType,\n isTupleType,\n isUndefinedType,\n isUnionType,\n isVoidType,\n} from '@trapi/core';\n\nimport { isObject } from 'smob';\nimport { buildSpecGeneratorOptions } from '../../core/config';\nimport { SwaggerError, SwaggerErrorCode } from '../../core/error';\nimport type { SpecGeneratorOptions, SpecGeneratorOptionsInput } from '../../core/config';\nimport { DataFormatName, DataTypeName } from '../../core/schema';\nimport type { ValidatorOpenApiMeta } from '../../core/types';\nimport { transformValueTo } from '../../core/utils';\n\nimport type {\n BaseSchema,\n Info,\n SchemaV2,\n SchemaV3,\n SpecV2,\n SpecV3,\n} from '../../core/schema';\n\nexport abstract class AbstractSpecGenerator<Spec extends SpecV2 | SpecV3, Schema extends SchemaV3 | SchemaV2> {\n protected spec: Spec | undefined;\n\n protected readonly metadata: Metadata;\n\n protected readonly config: SpecGeneratorOptions;\n\n constructor(metadata: Metadata, config: SpecGeneratorOptionsInput) {\n this.metadata = metadata;\n this.config = buildSpecGeneratorOptions(config);\n }\n\n public abstract build(): Promise<Spec>;\n\n protected buildInfo() {\n const info: Info = {\n title: this.config.name || 'Documentation',\n version: this.config.version || '1.0.0',\n };\n\n if (this.config.description) {\n info.description = this.config.description;\n }\n\n if (this.config.license) {\n info.license = { name: this.config.license };\n }\n\n return info;\n }\n\n protected buildTags() {\n // Tag entries are emitted only for controllers that declare extensions.\n // When multiple controllers share a tag name, their extensions merge into\n // the same Tag entry; on key conflict, the last controller processed wins\n // (silent — strict-mode validation is a future addition).\n // Hidden controllers are skipped. If a controller declares extensions but\n // no tags, the controller name is used as a synthetic tag name so the\n // extensions still surface in the spec.\n const tagMap = new Map<string, { name: string } & Record<string, unknown>>();\n\n for (const controller of this.metadata.controllers) {\n if (controller.hidden) {\n continue;\n }\n\n const extensions = controller.extensions ?? [];\n if (extensions.length === 0) {\n continue;\n }\n\n const tagNames = controller.tags.length > 0 ? controller.tags : [controller.name];\n const extensionFields = this.transformExtensions(extensions);\n\n for (const tagName of tagNames) {\n let entry = tagMap.get(tagName);\n if (!entry) {\n entry = { name: tagName };\n tagMap.set(tagName, entry);\n }\n\n Object.assign(entry, extensionFields);\n }\n }\n\n return Array.from(tagMap.values());\n }\n\n protected getSchemaForType(type: BaseType): Schema | BaseSchema<Schema> {\n if (isVoidType(type) || isUndefinedType(type) || isNeverType(type)) {\n return {} as Schema;\n } if (isReferenceType(type)) {\n return this.getSchemaForReferenceType(type);\n } if (isPrimitiveType(type)) {\n return this.getSchemaForPrimitiveType(type);\n } if (isArrayType(type)) {\n return this.getSchemaForArrayType(type);\n } if (isTupleType(type)) {\n return this.getSchemaForTupleType(type);\n } if (isEnumType(type)) {\n return this.getSchemaForEnumType(type);\n } if (isUnionType(type)) {\n return this.getSchemaForUnionType(type);\n } if (isIntersectionType(type)) {\n return this.getSchemaForIntersectionType(type);\n } if (isNestedObjectLiteralType(type)) {\n return this.getSchemaForObjectLiteralType(type);\n }\n\n return {} as Schema;\n }\n\n protected abstract getSchemaForIntersectionType(type: IntersectionType): Schema;\n\n protected getSchemaForEnumType(enumType: EnumType): Schema {\n const nullable = enumType.members.includes(null);\n const nonNullMembers = enumType.members.filter(\n (m): m is string | number | boolean => m !== null,\n );\n const type = this.decideEnumType(nonNullMembers);\n\n const schema = {\n type,\n enum: enumType.members.map((member) => transformValueTo(type, member)),\n } as Schema;\n\n this.applyNullable(schema, nullable);\n\n return schema;\n }\n\n protected abstract applyNullable(schema: Schema, nullable: boolean): void;\n\n private getSchemaForPrimitiveType(type: PrimitiveType): BaseSchema<Schema> {\n const PrimitiveSwaggerTypeMap: Partial<Record<TypeName, BaseSchema<Schema>>> = {\n [TypeName.ANY]: { additionalProperties: true },\n [TypeName.BINARY]: { type: DataTypeName.STRING, format: DataFormatName.BINARY },\n [TypeName.BOOLEAN]: { type: DataTypeName.BOOLEAN },\n [TypeName.BUFFER]: { type: DataTypeName.STRING, format: DataFormatName.BYTE },\n [TypeName.BYTE]: { type: DataTypeName.STRING, format: DataFormatName.BYTE },\n [TypeName.DATE]: { type: DataTypeName.STRING, format: DataFormatName.DATE },\n [TypeName.DATETIME]: { type: DataTypeName.STRING, format: DataFormatName.DATE_TIME },\n [TypeName.DOUBLE]: { type: DataTypeName.NUMBER, format: DataFormatName.DOUBLE },\n [TypeName.FILE]: { type: DataTypeName.STRING, format: DataFormatName.BINARY },\n [TypeName.FLOAT]: { type: DataTypeName.NUMBER, format: DataFormatName.FLOAT },\n [TypeName.BIGINT]: { type: DataTypeName.INTEGER },\n [TypeName.INTEGER]: { type: DataTypeName.INTEGER, format: DataFormatName.INT_32 },\n [TypeName.LONG]: { type: DataTypeName.INTEGER, format: DataFormatName.INT_64 },\n [TypeName.OBJECT]: {\n type: DataTypeName.OBJECT,\n additionalProperties: true,\n },\n [TypeName.STRING]: { type: DataTypeName.STRING },\n [TypeName.UNDEFINED]: {},\n };\n\n return PrimitiveSwaggerTypeMap[type.typeName] || { type: DataTypeName.OBJECT };\n }\n\n private getSchemaForArrayType(arrayType: ArrayType): BaseSchema<Schema> {\n return {\n type: DataTypeName.ARRAY,\n items: this.getSchemaForType(arrayType.elementType),\n };\n }\n\n private getSchemaForTupleType(tupleType: TupleType): BaseSchema<Schema> {\n if (tupleType.elements.length === 0) {\n return {\n type: DataTypeName.ARRAY,\n items: {},\n };\n }\n\n const elementSchemas = tupleType.elements.map((el) => this.getSchemaForType(el.type));\n\n if (elementSchemas.length === 1) {\n return {\n type: DataTypeName.ARRAY,\n items: elementSchemas[0],\n };\n }\n\n // Multiple elements → array with anyOf items\n return {\n type: DataTypeName.ARRAY,\n items: { anyOf: elementSchemas },\n };\n }\n\n public getSchemaForObjectLiteralType(objectLiteral: NestedObjectLiteralType): BaseSchema<Schema> {\n const properties = this.buildProperties(objectLiteral.properties);\n\n const additionalProperties = objectLiteral.additionalProperties &&\n this.getSchemaForType(objectLiteral.additionalProperties);\n\n const required = objectLiteral.properties\n .filter((prop: ResolverProperty) => prop.required && !this.isUndefinedProperty(prop))\n .map((prop: ResolverProperty) => prop.name);\n\n // An empty list required: [] is not valid.\n // If all properties are optional, do not specify the required keyword.\n return {\n properties,\n ...(additionalProperties && { additionalProperties }),\n ...(required && required.length && { required }),\n type: DataTypeName.OBJECT,\n } as BaseSchema<Schema>;\n }\n\n protected getSchemaForReferenceType(referenceType: ReferenceType): Schema {\n return { $ref: `${this.getRefPrefix()}${referenceType.refName}` } as Schema;\n }\n\n protected abstract getRefPrefix(): string;\n\n protected abstract getSchemaForUnionType(type: UnionType) : Schema;\n\n // ----------------------------------------------------------------\n\n protected buildSchemaForRefAlias(referenceType: RefAliasType): Schema {\n const swaggerType = this.getSchemaForType(referenceType.type);\n const format = referenceType.format as DataFormatName;\n\n return {\n ...(swaggerType as Schema),\n default: referenceType.default ?? swaggerType.default,\n example: referenceType.example ?? swaggerType.example,\n format: format ?? swaggerType.format,\n description: referenceType.description ?? swaggerType.description,\n ...this.transformValidators(referenceType.validators),\n };\n }\n\n protected buildSchemaForRefEnum(referenceType: RefEnumType): Schema {\n const output = {\n ...this.getSchemaForEnumType({\n typeName: TypeName.ENUM,\n members: referenceType.members,\n }),\n description: referenceType.description,\n } as Schema;\n\n if (\n typeof referenceType.memberNames !== 'undefined' &&\n referenceType.members.length === referenceType.memberNames.length\n ) {\n (output as any)['x-enum-varnames'] = referenceType.memberNames;\n }\n\n return output;\n }\n\n protected buildSchemasForReferenceTypes(extendFn?: (output: Schema, input: ReferenceType) => void) : Record<string, Schema> {\n const output: Record<string, Schema> = {};\n\n for (const referenceType of Object.values(this.metadata.referenceTypes)) {\n switch (referenceType.typeName) {\n case TypeName.REF_ALIAS: {\n output[referenceType.refName] = this.buildSchemaForRefAlias(referenceType);\n break;\n }\n case TypeName.REF_ENUM: {\n output[referenceType.refName] = this.buildSchemaForRefEnum(referenceType);\n break;\n }\n case TypeName.REF_OBJECT: {\n output[referenceType.refName] = this.buildSchemaForRefObject(referenceType);\n break;\n }\n }\n\n if (typeof extendFn === 'function') {\n extendFn(output[referenceType.refName]!, referenceType);\n }\n }\n\n return output;\n }\n\n // ----------------------------------------------------------------\n\n protected isUndefinedProperty(input: ResolverProperty) {\n return isUndefinedType(input.type) ||\n (isUnionType(input.type) && input.type.members.some((el) => isUndefinedType(el)));\n }\n\n protected buildProperties(properties: ResolverProperty[]): Record<string, Schema> {\n const output: Record<string, Schema> = {};\n\n properties.forEach((property) => {\n const swaggerType = this.getSchemaForType(property.type) as Schema;\n\n if (swaggerType.$ref && this.shouldStripRefSiblings()) {\n output[property.name] = { $ref: swaggerType.$ref } as Schema;\n return;\n }\n\n swaggerType.description = property.description;\n swaggerType.example = property.example;\n swaggerType.format = property.format as DataFormatName || swaggerType.format;\n this.assignPropertyDefaults(swaggerType, property);\n\n if (property.deprecated) {\n this.markPropertyDeprecated(swaggerType);\n }\n\n const extensions = this.transformExtensions(property.extensions);\n const validators = this.transformValidators(property.validators);\n output[property.name] = {\n ...swaggerType,\n ...validators,\n ...extensions,\n };\n });\n\n return output;\n }\n\n protected abstract markPropertyDeprecated(schema: Schema): void;\n\n protected shouldStripRefSiblings(): boolean {\n // V2 (Swagger 2.0) and V3 (3.0): $ref must be the only key.\n // V3 (3.1+): $ref siblings are allowed. Override to return false.\n return true;\n }\n\n protected assignPropertyDefaults(_schema: Schema, _property: ResolverProperty): void {\n // No-op by default. V3 overrides to set schema.default = property.default.\n }\n\n protected buildSchemaForRefObject(referenceType: RefObjectType): Schema {\n const required = referenceType.properties\n .filter((p) => p.required && !this.isUndefinedProperty(p))\n .map((p) => p.name);\n\n const output = {\n description: referenceType.description,\n properties: this.buildProperties(referenceType.properties),\n required: required && required.length > 0 ? Array.from(new Set(required)) : undefined,\n type: DataTypeName.OBJECT,\n } as unknown as Schema;\n\n if (referenceType.additionalProperties) {\n (output as any).additionalProperties = this.resolveAdditionalProperties(referenceType.additionalProperties);\n }\n\n if (referenceType.example !== undefined) {\n output.example = referenceType.example;\n }\n\n return output;\n }\n\n protected abstract resolveAdditionalProperties(type: BaseType): Schema | boolean;\n\n protected determineTypesUsedInEnum(anEnum: Array<string | number | boolean | null>) : VariableType[] {\n const set = new Set<VariableType>();\n for (const element of anEnum) {\n if (element === null) {\n continue;\n }\n\n set.add(typeof element);\n }\n\n return Array.from(set);\n }\n\n protected decideEnumType(\n input: Array<string | number | boolean>,\n ): 'string' | 'number' | 'boolean' {\n const types = this.determineTypesUsedInEnum(input);\n\n if (types.length === 1) {\n const value = types[0];\n if (\n value === 'string' ||\n value === 'number' ||\n value === 'boolean'\n ) {\n return value;\n }\n\n throw new SwaggerError({\n message: `Enum contains unsupported type '${types[0] || 'unknown'}'. Only string, number, and boolean values are allowed.`,\n code: SwaggerErrorCode.ENUM_UNSUPPORTED_TYPE,\n });\n }\n\n const unsupportedTypes = types.filter(\n (type) => type !== 'string' && type !== 'number' && type !== 'boolean',\n );\n if (unsupportedTypes.length > 0) {\n throw new SwaggerError({\n message: `Enum contains unsupported types: ${unsupportedTypes.join(', ')}. Only string, number, and boolean values are allowed.`,\n code: SwaggerErrorCode.ENUM_UNSUPPORTED_TYPE,\n });\n }\n\n return 'string';\n }\n\n protected getOperationId(name: string) {\n return name.charAt(0).toUpperCase() + name.substring(1);\n }\n\n protected groupParameters(items: Parameter[]) : Partial<Record<ParameterSource, Parameter[]>> {\n const output : Partial<Record<ParameterSource, Parameter[]>> = {};\n\n for (const item of items) {\n const bucket = output[item.in] ?? (output[item.in] = []);\n bucket.push(item);\n }\n\n return output;\n }\n\n protected transformExtensions(input?: Extension[]) : Record<string, any> {\n if (!input) {\n return {};\n }\n\n const output : Record<string, any> = {};\n for (const extension of input) {\n const key = extension.key.startsWith('x-') ? extension.key : `x-${extension.key}`;\n output[key] = extension.value;\n }\n\n return output;\n }\n\n protected transformValidators(input?: Validators) : Record<string, any> {\n if (!isObject(input)) {\n return {};\n }\n\n const output : Record<string, any> = {};\n for (const [name, validator] of Object.entries(input)) {\n const mapping = validator.meta?.openApi ?? DEFAULT_VALIDATOR_OPENAPI_MAPPINGS[name];\n if (!mapping || mapping.kind === 'ignore') {\n continue;\n }\n\n if (mapping.kind === 'keyword') {\n output[mapping.key] = validator.value;\n } else if (mapping.kind === 'format') {\n output.format = mapping.format;\n }\n }\n\n return output;\n }\n}\n\n// Default OpenAPI mappings for canonical validator names. Validator names that\n// do not appear here and that carry no `meta.openApi` hint are dropped — this\n// keeps third-party / custom validators out of the spec unless their handler\n// declares how to emit them.\nconst DEFAULT_VALIDATOR_OPENAPI_MAPPINGS: Record<string, ValidatorOpenApiMeta> = {\n maxLength: { kind: 'keyword', key: 'maxLength' },\n minLength: { kind: 'keyword', key: 'minLength' },\n maximum: { kind: 'keyword', key: 'maximum' },\n minimum: { kind: 'keyword', key: 'minimum' },\n pattern: { kind: 'keyword', key: 'pattern' },\n maxItems: { kind: 'keyword', key: 'maxItems' },\n minItems: { kind: 'keyword', key: 'minItems' },\n uniqueItems: { kind: 'keyword', key: 'uniqueItems' },\n};\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n BaseType,\n EnumType,\n IntersectionType,\n Method,\n Parameter,\n RefObjectType,\n Response,\n Type,\n UnionType,\n} from '@trapi/core';\nimport {\n ParameterSource,\n TypeName,\n isAnyType,\n isBinaryType,\n isEnumType,\n isNeverType,\n isRefEnumType,\n isRefObjectType,\n isUndefinedType,\n isVoidType,\n} from '@trapi/core';\nimport { URL } from 'node:url';\nimport { merge } from 'smob';\n\nimport type {\n BaseSchema,\n OperationV2,\n ParameterV2,\n Path,\n ResponseV2,\n SchemaV2,\n SecurityV2,\n SpecV2,\n} from '../../../core/schema';\nimport { DataTypeName, ParameterSourceV2 } from '../../../core/schema';\nimport type { SecurityDefinitions } from '../../../core/types';\nimport { SwaggerError, SwaggerErrorCode } from '../../../core/error';\nimport { joinPaths, normalizePathParameters } from '../../../core/utils';\nimport { AbstractSpecGenerator } from '../abstract';\n\nfunction uniqueOperationId(base: string, used: Set<string>): string {\n if (!used.has(base)) {\n used.add(base);\n return base;\n }\n let counter = 2;\n while (used.has(`${base}_${counter}`)) {\n counter += 1;\n }\n const candidate = `${base}_${counter}`;\n used.add(candidate);\n return candidate;\n}\n\nexport class V2Generator extends AbstractSpecGenerator<SpecV2, SchemaV2> {\n async build() : Promise<SpecV2> {\n if (typeof this.spec !== 'undefined') {\n return this.spec;\n }\n\n let spec: SpecV2 = {\n definitions: this.buildSchemasForReferenceTypes(),\n info: this.buildInfo(),\n paths: this.buildPaths(),\n swagger: '2.0',\n };\n\n spec.securityDefinitions = this.config.securityDefinitions ?\n V2Generator.translateSecurityDefinitions(this.config.securityDefinitions) :\n {};\n\n if (this.config.consumes) {\n spec.consumes = this.config.consumes;\n }\n\n if (this.config.produces) {\n spec.produces = this.config.produces;\n }\n\n const firstServer = this.config.servers?.[0];\n if (firstServer) {\n const url = new URL(firstServer.url, 'http://localhost:3000/');\n\n spec.host = url.host;\n if (url.pathname) {\n spec.basePath = url.pathname;\n }\n }\n\n const tags = this.buildTags();\n if (tags.length > 0) {\n spec.tags = tags;\n }\n\n if (this.config.specificationExtra) {\n spec = merge(spec, this.config.specificationExtra);\n }\n\n this.spec = spec;\n\n return spec;\n }\n\n private static translateSecurityDefinitions(securityDefinitions: SecurityDefinitions) : Record<string, SecurityV2> {\n const definitions : Record<string, SecurityV2> = {};\n\n for (const [key, securityDefinition] of Object.entries(securityDefinitions)) {\n switch (securityDefinition.type) {\n case 'http':\n if (securityDefinition.scheme === 'basic') {\n definitions[key] = { type: 'basic' };\n }\n break;\n case 'apiKey':\n definitions[key] = securityDefinition;\n break;\n case 'oauth2':\n if (securityDefinition.flows.implicit) {\n definitions[`${key}Implicit`] = {\n type: 'oauth2',\n flow: 'implicit',\n authorizationUrl: securityDefinition.flows.implicit.authorizationUrl,\n scopes: securityDefinition.flows.implicit.scopes,\n };\n }\n\n if (securityDefinition.flows.password) {\n definitions[`${key}Password`] = {\n type: 'oauth2',\n flow: 'password',\n tokenUrl: securityDefinition.flows.password.tokenUrl,\n scopes: securityDefinition.flows.password.scopes,\n };\n }\n\n if (securityDefinition.flows.authorizationCode) {\n definitions[`${key}AccessCode`] = {\n type: 'oauth2',\n flow: 'accessCode',\n tokenUrl: securityDefinition.flows.authorizationCode.tokenUrl,\n authorizationUrl: securityDefinition.flows.authorizationCode.authorizationUrl,\n scopes: securityDefinition.flows.authorizationCode.scopes,\n };\n }\n\n if (securityDefinition.flows.clientCredentials) {\n definitions[`${key}Application`] = {\n type: 'oauth2',\n flow: 'application',\n tokenUrl: securityDefinition.flows.clientCredentials.tokenUrl,\n scopes: securityDefinition.flows.clientCredentials.scopes,\n };\n }\n\n break;\n }\n }\n\n return definitions;\n }\n\n protected resolveAdditionalProperties(_type: BaseType): SchemaV2 | boolean {\n return true;\n }\n\n protected markPropertyDeprecated(schema: SchemaV2): void {\n schema['x-deprecated'] = true;\n }\n\n\n /*\n Path & Parameter ( + utils)\n */\n\n private buildPaths() {\n const output: Record<string, Path<OperationV2, ResponseV2>> = {};\n const usedOperationIds = new Set<string>();\n\n const unique = <T extends unknown[]>(input: T) : T => [...new Set(input)] as T;\n\n this.metadata.controllers.forEach((controller) => {\n if (controller.hidden) {\n return;\n }\n\n const controllerPaths = controller.paths.length === 0 ? [''] : controller.paths;\n\n controller.methods.forEach((method) => {\n if (method.hidden) {\n return;\n }\n\n method.consumes = unique([...controller.consumes, ...method.consumes]);\n method.produces = unique([...controller.produces, ...method.produces]);\n method.tags = unique([...controller.tags, ...method.tags]);\n // Inherit controller security only when the method declared none of its own.\n // `[]` is truthy, so a plain `||` short-circuits and never cascades.\n if (!method.security?.length) {\n method.security = controller.security;\n }\n // OpenAPI has no controller-level `deprecated` — cascade\n // controller deprecation to every emitted operation.\n method.deprecated = method.deprecated || controller.deprecated;\n // todo: unique for objects\n method.responses = unique([...controller.responses, ...method.responses]);\n\n for (const controllerPath of controllerPaths) {\n const fullPath = normalizePathParameters(joinPaths(controllerPath, method.path));\n\n const pathItem = output[fullPath] ?? (output[fullPath] = {});\n pathItem[method.method] = this.buildMethod(method, fullPath, usedOperationIds);\n }\n });\n });\n\n return output;\n }\n\n private buildMethod(\n method: Method,\n emittedPath: string,\n usedOperationIds: Set<string>,\n ) : OperationV2 {\n const output = this.buildOperation(method);\n output.consumes = this.buildMethodConsumes(method);\n\n // Prefer an explicit operationId from metadata (matches V3 behaviour),\n // then disambiguate across multi-mount controllers (the same method\n // emitted at multiple paths must not share an operationId).\n const baseOperationId = method.operationId || output.operationId!;\n output.operationId = uniqueOperationId(baseOperationId, usedOperationIds);\n\n output.description = method.description;\n if (method.summary) {\n output.summary = method.summary;\n }\n\n if (method.deprecated) { output.deprecated = method.deprecated; }\n if (method.tags.length) { output.tags = method.tags; }\n if (method.security?.length) {\n output.security = method.security;\n }\n\n const parameters = this.groupParameters(method.parameters);\n\n // Filter path-bound params not present in this specific URL template.\n const pathParams = (parameters[ParameterSource.PATH] || [])\n .filter((p) => emittedPath.includes(`{${p.name}}`));\n\n output.parameters = [\n ...pathParams,\n ...(parameters[ParameterSource.QUERY_PROP] || []),\n ...(parameters[ParameterSource.HEADER] || []),\n ...(parameters[ParameterSource.FORM_DATA] || []),\n ].map((p) => this.buildParameter(p));\n\n // ignore ParameterSource.QUERY!\n\n // ------------------------------------------------------\n\n const bodyParameters = (parameters[ParameterSource.BODY] || []);\n if (bodyParameters.length > 1) {\n throw new SwaggerError({\n message: `Only one body parameter allowed per method, but ${bodyParameters.length} found in '${method.name}'.`,\n code: SwaggerErrorCode.BODY_PARAMETER_DUPLICATE,\n });\n }\n\n const bodyParameter = bodyParameters[0] ?\n this.buildParameter(bodyParameters[0]) :\n undefined;\n\n const bodyPropParams = parameters[ParameterSource.BODY_PROP] || [];\n if (bodyPropParams.length > 0) {\n const schema : BaseSchema<SchemaV2> = {\n type: DataTypeName.OBJECT,\n title: 'Body',\n properties: {},\n };\n\n const required : string[] = [];\n\n for (const bodyPropParam of bodyPropParams) {\n const bodyProp = this.getSchemaForType(bodyPropParam.type);\n bodyProp.default = bodyPropParam.default;\n bodyProp.description = bodyPropParam.description;\n bodyProp.example = bodyPropParam.examples;\n\n if (bodyProp.required) {\n required.push(bodyPropParam.name);\n }\n\n schema.properties![bodyPropParam.name] = bodyProp;\n }\n\n if (\n bodyParameter &&\n bodyParameter.in === ParameterSourceV2.BODY\n ) {\n if (bodyParameter.schema.type === DataTypeName.OBJECT) {\n bodyParameter.schema.properties = {\n ...(bodyParameter.schema.properties || {}),\n ...schema.properties,\n };\n\n bodyParameter.schema.required = [\n ...(bodyParameter.schema.required || []),\n ...required,\n ];\n } else {\n bodyParameter.schema = schema;\n }\n\n output.parameters.push(bodyParameter);\n } else {\n const parameter : ParameterV2 = {\n in: ParameterSourceV2.BODY,\n name: 'body',\n schema,\n };\n\n if (required.length) {\n parameter.schema.required = required;\n }\n\n output.parameters.push(parameter);\n }\n } else if (bodyParameter) {\n output.parameters.push(bodyParameter);\n }\n\n Object.assign(output, this.transformExtensions(method.extensions));\n\n return output;\n }\n\n private transformParameterSource(\n source: `${ParameterSource}`,\n ) : `${ParameterSourceV2}` | undefined {\n if (\n source === ParameterSource.BODY\n ) {\n return ParameterSourceV2.BODY;\n }\n\n if (source === ParameterSource.FORM_DATA) {\n return ParameterSourceV2.FORM_DATA;\n }\n\n if (source === ParameterSource.HEADER) {\n return ParameterSourceV2.HEADER;\n }\n\n if (source === ParameterSource.PATH) {\n return ParameterSourceV2.PATH;\n }\n\n if (source === ParameterSource.QUERY || source === ParameterSource.QUERY_PROP) {\n return ParameterSourceV2.QUERY;\n }\n\n return undefined;\n }\n\n protected buildParameter(input: Parameter): ParameterV2 {\n const sourceIn = this.transformParameterSource(input.in);\n if (!sourceIn) {\n throw new SwaggerError({\n message: `The parameter source '${input.in}' for parameter '${input.name}' is not supported in OpenAPI 2.0.`,\n code: SwaggerErrorCode.PARAMETER_SOURCE_UNSUPPORTED,\n });\n }\n\n const parameter = {\n description: input.description,\n in: sourceIn,\n name: input.name,\n required: input.required,\n } as ParameterV2;\n\n Object.assign(parameter, this.transformExtensions(input.extensions));\n\n if (\n input.in !== ParameterSource.BODY &&\n isRefEnumType(input.type)\n ) {\n input.type = {\n typeName: TypeName.ENUM,\n members: input.type.members,\n };\n }\n\n // Swagger 2.0: formData file parameters use type: 'file' directly\n if (\n parameter.in === ParameterSourceV2.FORM_DATA &&\n input.type.typeName === TypeName.FILE\n ) {\n parameter.type = 'file' as `${DataTypeName}`;\n Object.assign(parameter, this.transformValidators(input.validators));\n return parameter;\n }\n\n const parameterType = this.getSchemaForType(input.type);\n if (\n parameter.in !== ParameterSourceV2.BODY &&\n parameterType.format\n ) {\n parameter.format = parameterType.format;\n }\n\n // collectionFormat, might be valid for all parameters (if value != multi)\n if (\n (parameter.in === ParameterSourceV2.FORM_DATA || parameter.in === ParameterSourceV2.QUERY) &&\n (input.type.typeName === TypeName.ARRAY || parameterType.type === DataTypeName.ARRAY)\n ) {\n parameter.collectionFormat = input.collectionFormat || this.config.collectionFormat || 'multi';\n }\n\n if (parameter.in === ParameterSourceV2.BODY) {\n if ((input.type.typeName === TypeName.ARRAY || parameterType.type === DataTypeName.ARRAY)) {\n parameter.schema = {\n items: parameterType.items,\n type: DataTypeName.ARRAY,\n };\n } else if (input.type.typeName === TypeName.ANY) {\n parameter.schema = { type: DataTypeName.OBJECT };\n } else {\n parameter.schema = parameterType;\n }\n\n parameter.schema = {\n ...parameter.schema,\n ...this.transformValidators(input.validators),\n };\n\n return parameter;\n }\n\n // todo: this is eventually illegal\n Object.assign(parameter, this.transformValidators(input.validators));\n\n if (input.type.typeName === TypeName.ANY) {\n parameter.type = DataTypeName.STRING;\n } else if (parameterType.type && !Array.isArray(parameterType.type)) {\n parameter.type = parameterType.type;\n }\n\n if (parameterType.items) {\n parameter.items = parameterType.items;\n }\n if (parameterType.enum) {\n parameter.enum = parameterType.enum;\n }\n\n if (typeof input.default !== 'undefined') {\n parameter.default = input.default;\n }\n\n return parameter;\n }\n\n private buildMethodConsumes(method: Method) : string[] {\n if (\n method.consumes &&\n method.consumes.length > 0\n ) {\n return method.consumes;\n }\n\n if (this.hasFileParams(method)) {\n return ['multipart/form-data'];\n }\n\n if (this.hasFormParams(method)) {\n return ['application/x-www-form-urlencoded'];\n }\n\n if (this.supportsBodyParameters(method.method)) {\n return ['application/json'];\n }\n\n return [];\n }\n\n private hasFileParams(method: Method) {\n return method.parameters.some((p) => (p.in === ParameterSource.FORM_DATA && p.type.typeName === 'file'));\n }\n\n private hasFormParams(method: Method) {\n return method.parameters.some((p) => (p.in === ParameterSource.FORM_DATA));\n }\n\n private supportsBodyParameters(method: string) {\n return ['post', 'put', 'patch'].includes(method);\n }\n\n /*\n Swagger Type ( + utils)\n */\n\n protected applyNullable(schema: SchemaV2, nullable: boolean): void {\n schema['x-nullable'] = nullable;\n }\n\n protected getRefPrefix(): string {\n return '#/definitions/';\n }\n\n protected getSchemaForIntersectionType(type: IntersectionType) : SchemaV2 {\n // tslint:disable-next-line:no-shadowed-variable\n const properties = type.members.reduce((acc, type) => {\n if (isRefObjectType(type)) {\n const refType = this.metadata.referenceTypes[type.refName] as RefObjectType;\n\n const props = refType &&\n refType.properties &&\n refType.properties.reduce((pAcc, prop) => ({\n ...pAcc,\n [prop.name]: this.getSchemaForType(prop.type),\n }), {});\n return { ...acc, ...props };\n }\n return { ...acc };\n }, {});\n\n return { type: DataTypeName.OBJECT, properties };\n }\n\n\n protected getSchemaForUnionType(type: UnionType) : SchemaV2 {\n const members : Type[] = [];\n\n const enumTypeMember : EnumType = { typeName: TypeName.ENUM, members: [] };\n for (const member of type.members) {\n if (isEnumType(member)) {\n enumTypeMember.members.push(...member.members);\n }\n\n if (\n !isAnyType(member) &&\n !isUndefinedType(member) &&\n !isNeverType(member) &&\n !isEnumType(member)\n ) {\n members.push(member);\n }\n }\n\n if (\n members.length === 0 &&\n enumTypeMember.members.length > 0\n ) {\n return this.getSchemaForEnumType(enumTypeMember);\n }\n\n const isNullEnum = enumTypeMember.members.every((member) => member === null);\n if (members.length === 1) {\n const single = members[0]!;\n if (isNullEnum) {\n const memberType = this.getSchemaForType(single) as SchemaV2;\n if (memberType.$ref) {\n return memberType;\n }\n\n memberType['x-nullable'] = true;\n return memberType;\n }\n\n if (enumTypeMember.members.length === 0) {\n return this.getSchemaForType(single);\n }\n }\n\n return { type: DataTypeName.OBJECT, ...(isNullEnum ? { 'x-nullable': true } : {}) };\n }\n\n private buildOperation(method: Method) {\n const operation : OperationV2 = {\n operationId: this.getOperationId(method.name),\n consumes: method.consumes || [],\n produces: method.produces || [],\n responses: {},\n };\n\n const produces : string[] = [];\n\n method.responses.forEach((res: Response) => {\n operation.responses[res.status] = { description: res.description };\n\n if (\n res.schema &&\n !isVoidType(res.schema) &&\n !isNeverType(res.schema)\n ) {\n if (res.produces) {\n produces.push(...res.produces);\n } else if (isBinaryType(res.schema)) {\n produces.push('application/octet-stream');\n }\n\n operation.responses[res.status]!.schema = this.getSchemaForType(res.schema);\n }\n\n const example = res.examples?.[0];\n if (example?.value) {\n operation.responses[res.status]!.examples = { 'application/json': example.value };\n }\n });\n\n const consumes = operation.consumes!;\n if (consumes.length === 0) {\n const hasBody = method.parameters\n .some((parameter) => parameter.in === ParameterSource.BODY || parameter.in === ParameterSource.BODY_PROP);\n if (hasBody) {\n consumes.push('application/json');\n }\n\n const hasFormData = method.parameters\n .some((parameter) => parameter.in === ParameterSource.FORM_DATA);\n if (hasFormData) {\n consumes.push('multipart/form-data');\n }\n }\n\n if (\n operation.produces!.length === 0 &&\n produces.length > 0\n ) {\n operation.produces = [...new Set(produces)];\n }\n\n if (operation.produces!.length === 0) {\n operation.produces = ['application/json'];\n }\n\n return operation;\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type {\n BaseType,\n EnumType,\n IntersectionType,\n Metadata,\n Method,\n NestedObjectLiteralType,\n Parameter,\n RefAliasType,\n RefEnumType,\n RefObjectType,\n ResolverProperty,\n Response,\n Type, \n UnionType, \n} from '@trapi/core';\nimport {\n ParameterSource,\n TypeName,\n isAnyType,\n isEnumType,\n isIntersectionType,\n isNestedObjectLiteralType,\n isNeverType,\n isRefAliasType,\n isRefObjectType,\n isUndefinedType,\n isVoidType,\n} from '@trapi/core';\nimport { URL } from 'node:url';\nimport { merge } from 'smob';\nimport type {\n Example,\n HeaderV3,\n MediaTypeV3,\n OperationV3,\n ParameterV3,\n Path,\n RequestBodyV3,\n ResponseV3,\n SchemaV3,\n SecurityV3,\n ServerV3,\n SpecV3,\n} from '../../../core/schema';\nimport {\n DataTypeName,\n ParameterSourceV3,\n} from '../../../core/schema';\nimport type { SpecGeneratorOptionsInput } from '../../../core/config';\nimport type { SecurityDefinitions } from '../../../core/types';\nimport { SwaggerError, SwaggerErrorCode } from '../../../core/error';\nimport {\n joinPaths,\n normalizePathParameters,\n} from '../../../core/utils';\nimport { AbstractSpecGenerator } from '../abstract';\nimport type { Version } from '../../../core/constants';\n\nconst OPENAPI_VERSION_MAP: Partial<Record<`${Version}`, string>> = {\n v3: '3.0.0',\n 'v3.1': '3.1.0',\n 'v3.2': '3.2.0',\n};\n\nfunction uniqueOperationId(base: string, used: Set<string>): string {\n if (!used.has(base)) {\n used.add(base);\n return base;\n }\n let counter = 2;\n while (used.has(`${base}_${counter}`)) {\n counter += 1;\n }\n const candidate = `${base}_${counter}`;\n used.add(candidate);\n return candidate;\n}\n\nexport class V3Generator extends AbstractSpecGenerator<SpecV3, SchemaV3> {\n private readonly openApiVersion: string;\n\n constructor(\n metadata: Metadata,\n config: SpecGeneratorOptionsInput,\n version: `${Version}` = 'v3.2',\n ) {\n super(metadata, config);\n this.openApiVersion = OPENAPI_VERSION_MAP[version] || '3.2.0';\n }\n\n async build() : Promise<SpecV3> {\n if (typeof this.spec !== 'undefined') {\n return this.spec;\n }\n\n let spec: SpecV3 = {\n components: this.buildComponents(),\n info: this.buildInfo(),\n openapi: this.openApiVersion,\n paths: this.buildPaths(),\n servers: this.buildServers(),\n tags: this.buildTags(),\n };\n\n if (this.config.specificationExtra) {\n spec = merge(spec, this.config.specificationExtra);\n }\n\n this.spec = spec;\n\n return spec;\n }\n\n private buildComponents() {\n const components = {\n examples: {},\n headers: {},\n parameters: {},\n requestBodies: {},\n responses: {},\n schemas: this.buildSchemasForReferenceTypes((output, referenceType) => {\n if (referenceType.deprecated) {\n output.deprecated = true;\n }\n }),\n securitySchemes: {},\n };\n\n if (this.config.securityDefinitions) {\n components.securitySchemes = V3Generator.translateSecurityDefinitions(this.config.securityDefinitions);\n }\n\n return components;\n }\n\n private static translateSecurityDefinitions(\n securityDefinitions: SecurityDefinitions,\n ) : Record<string, SecurityV3> {\n const output : Record<string, SecurityV3> = {};\n\n for (const [key, securityDefinition] of Object.entries(securityDefinitions)) {\n switch (securityDefinition.type) {\n case 'http':\n output[key] = securityDefinition;\n break;\n case 'oauth2':\n output[key] = securityDefinition;\n break;\n case 'apiKey':\n output[key] = securityDefinition;\n break;\n }\n }\n\n return output;\n }\n\n private buildPaths() {\n const output: Record<string, Path<OperationV3, ParameterV3>> = {};\n const usedOperationIds = new Set<string>();\n\n for (const controller of this.metadata.controllers) {\n if (controller.hidden) {\n continue;\n }\n\n const controllerPaths = controller.paths.length === 0 ? [''] : controller.paths;\n\n for (const method of controller.methods) {\n if (method.hidden) {\n continue;\n }\n\n // OpenAPI has no controller-level `deprecated` — cascade\n // controller deprecation to every emitted operation.\n method.deprecated = method.deprecated || controller.deprecated;\n\n // Inherit controller security only when the method declared none of its own.\n // OpenAPI 3.x: an operation's `security: []` explicitly removes any inherited\n // requirement, so we must omit the field when the method has no security\n // rather than emitting an empty array.\n if (!method.security?.length) {\n method.security = controller.security;\n }\n\n for (const controllerPath of controllerPaths) {\n const path = normalizePathParameters(joinPaths(controllerPath, method.path));\n\n const pathItem = output[path] ?? (output[path] = {});\n pathItem[method.method] = this.buildMethod(controller.name, method, path, usedOperationIds);\n }\n }\n }\n\n return output;\n }\n\n private buildMethod(\n controllerName: string,\n method: Method,\n emittedPath: string,\n usedOperationIds: Set<string>,\n ) : OperationV3 {\n const output = this.buildOperation(controllerName, method);\n\n output.description = method.description;\n output.summary = method.summary;\n output.tags = method.tags;\n\n // Use the explicit operationId tag if provided, otherwise the generated\n // one. When the same method is mounted at multiple controller paths the\n // operationIds collide — disambiguate by suffixing _2, _3, ... so the\n // emitted spec stays OpenAPI-valid.\n const baseOperationId = method.operationId || output.operationId!;\n output.operationId = uniqueOperationId(baseOperationId, usedOperationIds);\n\n if (method.deprecated) {\n output.deprecated = method.deprecated;\n }\n\n if (method.security?.length) {\n output.security = method.security as any[];\n }\n\n const parameters = this.groupParameters(method.parameters);\n\n // Path parameters declared on the method may not all appear in every\n // controller mount (e.g. /roles vs /realms/:id/roles). Only emit\n // path-bound params that are present in `emittedPath`.\n const pathParams = (parameters[ParameterSource.PATH] || [])\n .filter((p) => emittedPath.includes(`{${p.name}}`));\n\n output.parameters = [\n ...(parameters[ParameterSource.QUERY_PROP] || []),\n ...(parameters[ParameterSource.HEADER] || []),\n ...pathParams,\n ...(parameters[ParameterSource.COOKIE] || []),\n ]\n .map((p) => this.buildParameter(p));\n\n // ignore ParameterSource.QUERY!\n\n const bodyParams = parameters[ParameterSource.BODY] || [];\n const formParams = parameters[ParameterSource.FORM_DATA] || [];\n\n if (bodyParams.length > 1) {\n throw new SwaggerError({\n message: `Only one body parameter allowed per method, but ${bodyParams.length} found in '${method.name}'.`,\n code: SwaggerErrorCode.BODY_PARAMETER_DUPLICATE,\n });\n }\n\n if (bodyParams.length > 0 && formParams.length > 0) {\n throw new SwaggerError({\n message: `Cannot mix body and form parameters in method '${method.name}'.`,\n code: SwaggerErrorCode.BODY_FORM_CONFLICT,\n });\n }\n\n const bodyPropParams = parameters[ParameterSource.BODY_PROP] || [];\n const firstBodyProp = bodyPropParams[0];\n if (firstBodyProp) {\n if (bodyParams.length === 0) {\n bodyParams.push({\n in: ParameterSource.BODY,\n name: 'body',\n description: '',\n parameterName: firstBodyProp.parameterName || 'body',\n required: true,\n type: {\n typeName: TypeName.NESTED_OBJECT_LITERAL,\n properties: [],\n },\n validators: {},\n deprecated: false,\n extensions: [],\n });\n }\n\n const firstBody = bodyParams[0]!;\n if (isNestedObjectLiteralType(firstBody.type)) {\n for (const bodyPropParam of bodyPropParams) {\n firstBody.type.properties.push({\n default: bodyPropParam.default,\n validators: bodyPropParam.validators,\n description: bodyPropParam.description,\n name: bodyPropParam.name,\n type: bodyPropParam.type,\n required: bodyPropParam.required,\n deprecated: bodyPropParam.deprecated ?? false,\n });\n }\n }\n }\n\n const firstBodyParam = bodyParams[0];\n if (firstBodyParam) {\n output.requestBody = this.buildRequestBody(firstBodyParam);\n } else if (formParams.length > 0) {\n output.requestBody = this.buildRequestBodyWithFormData(formParams);\n }\n\n Object.assign(output, this.transformExtensions(method.extensions));\n\n return output;\n }\n\n private buildRequestBodyWithFormData(parameters: Parameter[]): RequestBodyV3 {\n const required: string[] = [];\n const properties: Record<string, SchemaV3> = {};\n\n for (const parameter of parameters) {\n properties[parameter.name] = this.buildMediaType(parameter).schema!;\n\n if (parameter.required) {\n required.push(parameter.name);\n }\n }\n\n return {\n required: required.length > 0,\n content: {\n 'multipart/form-data': {\n schema: {\n type: DataTypeName.OBJECT,\n properties,\n // An empty list required: [] is not valid.\n // If all properties are optional, do not specify the required keyword.\n ...(required && required.length && { required }),\n },\n },\n },\n };\n }\n\n private buildRequestBody(parameter: Parameter): RequestBodyV3 {\n const mediaType = this.buildMediaType(parameter);\n\n return {\n description: parameter.description,\n required: parameter.required,\n content: { 'application/json': mediaType },\n };\n }\n\n private buildMediaType(parameter: Parameter): MediaTypeV3 {\n const examples = this.transformParameterExamples(parameter);\n return {\n schema: this.getSchemaForType(parameter.type),\n ...(Object.keys(examples).length > 0 && { examples }),\n };\n }\n\n protected buildResponses(input: Response[]) : Record<string, ResponseV3> {\n const output: Record<string, ResponseV3> = {};\n\n for (const res of input) {\n const name : string = res.status || 'default';\n const response: ResponseV3 = { description: res.description };\n output[name] = response;\n\n if (\n res.schema &&\n !isVoidType(res.schema) &&\n !isNeverType(res.schema)\n ) {\n const examples : Record<string, Example> = {};\n if (res.examples) {\n for (const [i, ex] of res.examples.entries()) {\n const label = ex.label || `example${i + 1}`;\n examples[label] = { value: ex.value };\n }\n }\n\n const content = response.content ?? (response.content = {});\n\n const contentTypes = res.produces || ['application/json'];\n for (const contentType of contentTypes) {\n content[contentType] = {\n schema: this.getSchemaForType(res.schema),\n ...(Object.keys(examples).length > 0 && { examples }),\n };\n }\n }\n\n if (res.headers) {\n const headers: Record<string, HeaderV3> = {};\n if (isRefObjectType(res.headers)) {\n headers[res.headers.refName] = {\n schema: this.getSchemaForReferenceType(res.headers) as SchemaV3,\n description: res.headers.description,\n };\n } else if (isNestedObjectLiteralType(res.headers)) {\n res.headers.properties.forEach((each: ResolverProperty) => {\n headers[each.name] = {\n schema: this.getSchemaForType(each.type) as SchemaV3,\n description: each.description,\n required: each.required,\n };\n });\n }\n\n response.headers = headers;\n }\n }\n\n return output;\n }\n\n protected buildOperation(_controllerName: string, method: Method): OperationV3 {\n const operation : OperationV3 = {\n operationId: this.getOperationId(method.name),\n responses: this.buildResponses(method.responses),\n };\n if (method.description) {\n operation.description = method.description;\n }\n if (method.security?.length) {\n operation.security = method.security;\n }\n if (method.deprecated) {\n operation.deprecated = method.deprecated;\n }\n\n return operation;\n }\n\n protected transformParameterSource(\n source: `${ParameterSource}`,\n ) : `${ParameterSourceV3}` | undefined {\n if (source === ParameterSource.COOKIE) {\n return ParameterSourceV3.COOKIE;\n }\n\n if (source === ParameterSource.HEADER) {\n return ParameterSourceV3.HEADER;\n }\n\n if (source === ParameterSource.PATH) {\n return ParameterSourceV3.PATH;\n }\n\n if (source === ParameterSource.QUERY_PROP || source === ParameterSource.QUERY) {\n return ParameterSourceV3.QUERY;\n }\n\n return undefined;\n }\n\n protected buildParameter(input: Parameter): ParameterV3 {\n const sourceIn = this.transformParameterSource(input.in);\n if (!sourceIn) {\n throw new SwaggerError({\n message: `The parameter source '${input.in}' for parameter '${input.name}' is not supported in OpenAPI 3.x.`,\n code: SwaggerErrorCode.PARAMETER_SOURCE_UNSUPPORTED,\n });\n }\n\n const parameter : ParameterV3 = {\n allowEmptyValue: false,\n deprecated: false,\n description: input.description,\n in: sourceIn,\n name: input.name,\n required: input.required,\n schema: {\n default: input.default,\n format: undefined,\n ...this.transformValidators(input.validators),\n },\n };\n\n Object.assign(parameter, this.transformExtensions(input.extensions));\n\n if (input.deprecated) {\n parameter.deprecated = true;\n }\n\n const parameterType = this.getSchemaForType(input.type);\n const schema = parameter.schema!;\n if (parameterType.format) {\n schema.format = parameterType.format;\n }\n\n if (parameterType.$ref) {\n parameter.schema = parameterType;\n return parameter;\n }\n\n if (isAnyType(input.type)) {\n schema.type = DataTypeName.STRING;\n } else {\n if (parameterType.type) {\n schema.type = parameterType.type as DataTypeName;\n }\n schema.items = parameterType.items;\n schema.enum = parameterType.enum;\n }\n\n parameter.examples = this.transformParameterExamples(input);\n\n return parameter;\n }\n\n private transformParameterExamples(parameter: Parameter) : Record<string, Example> {\n const output : Record<string, Example> = {};\n if (parameter.examples) {\n for (const [i, ex] of parameter.examples.entries()) {\n const label = ex.label || `example${i + 1}`;\n output[label] = { value: ex.value };\n }\n }\n\n return output;\n }\n\n private buildServers() : ServerV3[] {\n const servers: ServerV3[] = [];\n const configured = this.config.servers ?? [];\n for (const entry of configured) {\n const url = new URL(entry.url, 'http://localhost:3000/');\n servers.push({\n url: `${url.protocol}//${url.host}${url.pathname || ''}`,\n ...(entry.description ? { description: entry.description } : {}),\n });\n }\n\n return servers;\n }\n\n protected resolveAdditionalProperties(type: BaseType): SchemaV3 {\n return this.getSchemaForType(type) as SchemaV3;\n }\n\n protected markPropertyDeprecated(schema: SchemaV3): void {\n schema.deprecated = true;\n }\n\n protected override assignPropertyDefaults(schema: SchemaV3, property: ResolverProperty): void {\n schema.default = property.default;\n }\n\n protected override buildSchemaForRefEnum(referenceType: RefEnumType): SchemaV3 {\n const typesUsed = this.determineTypesUsedInEnum(referenceType.members);\n\n // Single-type enums use the shared base implementation\n if (typesUsed.length === 1) {\n return super.buildSchemaForRefEnum(referenceType) as SchemaV3;\n }\n\n // Multi-type enums use anyOf with per-type sub-schemas (V3 only)\n const schema: SchemaV3 = {\n description: referenceType.description,\n anyOf: [],\n };\n\n for (const element of typesUsed) {\n schema.anyOf!.push({\n type: element as `${DataTypeName}`,\n enum: referenceType.members.filter((e) => typeof e === element),\n });\n }\n\n return schema;\n }\n\n private isV31OrLater(): boolean {\n return !this.openApiVersion.startsWith('3.0');\n }\n\n protected override shouldStripRefSiblings(): boolean {\n return !this.isV31OrLater();\n }\n\n protected getSchemaForIntersectionType(type: IntersectionType) : SchemaV3 {\n return { allOf: type.members.map((x: Type) => this.getSchemaForType(x)) };\n }\n\n protected applyNullable(schema: SchemaV3, nullable: boolean): void {\n if (!nullable) {\n return;\n }\n\n if (this.isV31OrLater()) {\n // 3.1+: use type arrays instead of nullable keyword\n if (schema.type && !Array.isArray(schema.type)) {\n schema.type = [schema.type, 'null'];\n } else if (Array.isArray(schema.type) && !schema.type.includes('null')) {\n schema.type = [...schema.type, 'null'];\n }\n } else {\n // 3.0: use nullable keyword\n schema.nullable = true;\n }\n }\n\n protected getRefPrefix(): string {\n return '#/components/schemas/';\n }\n\n protected getSchemaForUnionType(type: UnionType) : SchemaV3 {\n const members : Type[] = [];\n\n let nullable = false;\n const enumMembers : Record<string, Array<string | number | boolean>> = {};\n for (const member of type.members) {\n if (isEnumType(member)) {\n for (const memberChild of member.members) {\n if (memberChild === null || memberChild === undefined) {\n nullable = true;\n continue;\n }\n\n const typeOf = typeof memberChild;\n if (typeOf === 'string' || typeOf === 'number' || typeOf === 'boolean') {\n const bucket = enumMembers[typeOf] ?? (enumMembers[typeOf] = []);\n bucket.push(memberChild);\n }\n }\n }\n\n if (\n !isAnyType(member) &&\n !isUndefinedType(member) &&\n !isNeverType(member) &&\n !isEnumType(member)\n ) {\n members.push(member);\n }\n }\n\n const schemas : SchemaV3[] = [];\n for (const member of members) {\n schemas.push(this.getSchemaForType(member));\n }\n\n const enumMembersKeys = Object.keys(enumMembers);\n for (const enumMembersKey of enumMembersKeys) {\n const enumType : EnumType = {\n typeName: 'enum',\n members: enumMembers[enumMembersKey]!,\n };\n schemas.push(this.getSchemaForEnumType(enumType));\n }\n\n // Use oneOf when all non-enum members are object-like types\n const useOneOf = members.length > 0 &&\n enumMembersKeys.length === 0 &&\n members.every((m) => V3Generator.isObjectLikeType(m));\n\n const compositionKey = useOneOf ? 'oneOf' : 'anyOf';\n\n if (this.isV31OrLater()) {\n if (nullable) {\n schemas.push({ type: 'null' } as unknown as SchemaV3);\n }\n\n if (schemas.length === 1) {\n return schemas[0]!;\n }\n\n const schema: SchemaV3 = { [compositionKey]: schemas };\n if (useOneOf) {\n this.applyDiscriminator(schema, members);\n }\n return schema;\n }\n\n // 3.0: use nullable keyword\n if (schemas.length === 1) {\n const schema = schemas[0]!;\n\n if (schema.$ref) {\n return { allOf: [schema], nullable };\n }\n\n return { ...schema, nullable };\n }\n\n const schema: SchemaV3 = {\n [compositionKey]: schemas,\n ...(nullable ? { nullable } : {}),\n };\n if (useOneOf) {\n this.applyDiscriminator(schema, members);\n }\n return schema;\n }\n\n private static isObjectLikeType(type: Type): boolean {\n if (isRefObjectType(type) ||\n isNestedObjectLiteralType(type) ||\n isIntersectionType(type)) {\n return true;\n }\n\n // Unwrap refAlias to check the underlying type — a refAlias\n // wrapping a primitive (e.g. `type Id = string`) is not object-like.\n if (isRefAliasType(type)) {\n return V3Generator.isObjectLikeType(type.type);\n }\n\n return false;\n }\n\n private applyDiscriminator(schema: SchemaV3, members: Type[]): void {\n const discriminator = this.detectDiscriminator(members);\n if (discriminator) {\n schema.discriminator = discriminator;\n }\n }\n\n private detectDiscriminator(\n members: Type[],\n ): { propertyName: string; mapping: Record<string, string> } | undefined {\n // Resolve each member to { refName, properties }. Supports both\n // refObject and refAlias members (#783).\n const resolvedMembers = members.map((m) => this.resolveDiscriminatorMember(m));\n if (resolvedMembers.some((m) => !m)) {\n return undefined;\n }\n\n // Find a common property with distinct enum literal values in each member\n const firstProps = resolvedMembers[0]!.properties;\n for (const prop of firstProps) {\n if (prop.type.typeName !== 'enum') continue;\n const enumType = prop.type as EnumType;\n if (enumType.members.length !== 1) continue;\n\n const propName = prop.name;\n const mapping: Record<string, string> = {};\n let isDiscriminator = true;\n\n for (const member of resolvedMembers) {\n const memberProp = member!.properties.find((p) => p.name === propName);\n if (\n !memberProp ||\n !memberProp.required ||\n memberProp.type.typeName !== 'enum' ||\n (memberProp.type as EnumType).members.length !== 1\n ) {\n isDiscriminator = false;\n break;\n }\n\n const value = String((memberProp.type as EnumType).members[0]);\n if (mapping[value]) {\n isDiscriminator = false;\n break;\n }\n mapping[value] = `${this.getRefPrefix()}${member!.refName}`;\n }\n\n if (isDiscriminator && Object.keys(mapping).length === members.length) {\n return { propertyName: propName, mapping };\n }\n }\n\n return undefined;\n }\n\n /**\n * Resolve a union member to its refName and properties for discriminator\n * detection. Accepts both refObject and refAlias members, unwrapping\n * aliases to find the underlying properties while preserving the\n * original refName for $ref mapping.\n */\n private resolveDiscriminatorMember(\n member: Type,\n ): { refName: string; properties: ResolverProperty[] } | undefined {\n if (!isRefObjectType(member) && !isRefAliasType(member)) {\n return undefined;\n }\n\n const { refName } = member as RefObjectType | RefAliasType;\n const referenceType = this.metadata.referenceTypes[refName];\n if (!referenceType) {\n return undefined;\n }\n\n if (referenceType.typeName === 'refObject') {\n return { refName, properties: (referenceType as RefObjectType).properties };\n }\n\n if (referenceType.typeName === 'refAlias') {\n let inner: Type = (referenceType as RefAliasType).type;\n for (let depth = 0; depth < 10; depth++) {\n if (isRefObjectType(inner)) {\n const resolved = this.metadata.referenceTypes[inner.refName];\n if (resolved?.typeName === 'refObject') {\n return { refName, properties: (resolved as RefObjectType).properties };\n }\n return undefined;\n }\n if (isNestedObjectLiteralType(inner)) {\n return { refName, properties: (inner as NestedObjectLiteralType).properties };\n }\n if (isRefAliasType(inner)) {\n inner = (inner as RefAliasType).type;\n continue;\n }\n return undefined;\n }\n }\n\n return undefined;\n }\n}\n","/*\n * Copyright (c) 2021-2023.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport { isMetadata } from '@trapi/core';\nimport type { SpecGeneratorOptionsInput, SwaggerGenerateOptions } from '../core/config';\nimport { Version } from '../core/constants';\nimport { SwaggerError } from '../core/error/module';\nimport { SwaggerErrorCode } from '../core/error/codes';\nimport type { OutputForVersion } from '../core/types';\nimport { V2Generator, V3Generator } from '../adapters/index.ts';\n\nfunction toSpecGeneratorOptionsInput(options: SwaggerGenerateOptions): SpecGeneratorOptionsInput {\n const { data } = options;\n\n if (!data) {\n return {};\n }\n\n return {\n name: data.name,\n version: data.version,\n description: data.description,\n license: data.license,\n servers: data.servers,\n securityDefinitions: data.securityDefinitions,\n consumes: data.consumes,\n produces: data.produces,\n collectionFormat: data.collectionFormat,\n specificationExtra: data.extra,\n };\n}\n\nexport async function generateSwagger<V extends `${Version}`>(\n options: Omit<SwaggerGenerateOptions, 'version'> & { version: V },\n): Promise<OutputForVersion<V>> {\n const { metadata } = options;\n if (!isMetadata(metadata)) {\n throw new SwaggerError({\n message: 'Expected `options.metadata` to be a pre-built Metadata object ({ controllers, referenceTypes }). Run `generateMetadata` from `@trapi/metadata` first, or supply your own Metadata-shaped value.',\n code: SwaggerErrorCode.METADATA_INVALID,\n });\n }\n const specGeneratorOptionsInput = toSpecGeneratorOptionsInput(options);\n\n switch (options.version) {\n case Version.V3:\n case Version.V3_1:\n case Version.V3_2: {\n const generator = new V3Generator(metadata, specGeneratorOptionsInput, options.version);\n\n return await generator.build() as OutputForVersion<V>;\n }\n default: {\n const generator = new V2Generator(metadata, specGeneratorOptionsInput);\n\n return await generator.build() as OutputForVersion<V>;\n }\n }\n}\n","/*\n * Copyright (c) 2024.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport process from 'node:process';\nimport { YAMLWriter } from 'locter';\nimport type { SwaggerSaveOptions } from '../core/config';\nimport { DocumentFormat } from '../core/constants';\nimport type { SpecV2, SpecV3 } from '../core/schema';\nimport type { DocumentFormatData } from '../core/types';\n\nconst EXTENSION_PATTERN = /\\.(json|ya?ml)$/i;\n\nfunction resolveFileName(name: string | undefined, format: `${DocumentFormat}`): string {\n const base = (name ?? 'swagger').replace(EXTENSION_PATTERN, '');\n return `${base}.${format}`;\n}\n\nfunction serialise(spec: SpecV2 | SpecV3, format: `${DocumentFormat}`): string {\n if (format === DocumentFormat.YAML) {\n return new YAMLWriter().stringify(spec);\n }\n return JSON.stringify(spec, null, 4);\n}\n\nexport async function saveSwagger(\n spec: SpecV2 | SpecV3,\n options: SwaggerSaveOptions = {},\n): Promise<DocumentFormatData> {\n const format: `${DocumentFormat}` = options.format ?? DocumentFormat.JSON;\n\n let cwd = process.cwd();\n if (options.cwd) {\n cwd = path.isAbsolute(options.cwd) ? options.cwd : path.join(process.cwd(), options.cwd);\n }\n\n const name = resolveFileName(options.name, format);\n const filePath = path.join(cwd, name);\n\n await fs.promises.mkdir(cwd, { recursive: true });\n\n const content = serialise(spec, format);\n await fs.promises.writeFile(filePath, content, { encoding: 'utf-8' });\n\n return {\n path: filePath,\n name,\n content,\n };\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,0BAA0B,OAAyD;CAC/F,MAAM,UAA2B,CAAC;CAClC,IAAI,MAAM,SACN,IAAI,MAAM,QAAQ,MAAM,OAAO,GAC3B,KAAK,MAAM,UAAU,MAAM,SACvB,IAAI,OAAO,WAAW,UAClB,QAAQ,KAAK,EAAE,KAAK,OAAO,CAAC;MAE5B,QAAQ,KAAK,MAAM;MAGxB,IAAI,OAAO,MAAM,YAAY,UAChC,QAAQ,KAAK,EAAE,KAAK,MAAM,QAAQ,CAAC;MAEnC,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K,EAAE,WAAW,KAAK,CAAC;CAEhD,MAAM,UAAU,UAAU,MAAM,MAAM;CACtC,MAAM,GAAG,SAAS,UAAU,UAAU,SAAS,EAAE,UAAU,QAAQ,CAAC;CAEpE,OAAO;EACH,MAAM;EACN;EACA;CACJ;AACJ"}
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/tada5hi"
7
7
  },
8
8
  "license": "MIT",
9
- "version": "2.0.1",
9
+ "version": "2.0.2",
10
10
  "description": "Generate Swagger files from a decorator APIs.",
11
11
  "keywords": [
12
12
  "typescript",
@@ -42,15 +42,13 @@
42
42
  "preblushOnly": "npm run build"
43
43
  },
44
44
  "devDependencies": {
45
- "@types/yamljs": "^0.2.34",
46
- "jsonata": "^2.2.1",
47
- "locter": "^3.0.0"
45
+ "jsonata": "^2.2.2"
48
46
  },
49
47
  "dependencies": {
50
48
  "@ebec/core": "^1.1.0",
51
- "@trapi/core": "2.0.1",
49
+ "@trapi/core": "2.0.2",
52
50
  "smob": "^1.6.2",
53
- "yamljs": "^0.3.0"
51
+ "locter": "^4.0.0"
54
52
  },
55
53
  "repository": {
56
54
  "type": "git",