@trapi/swagger 2.0.0-beta.4 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -709,6 +709,7 @@ declare function removeFinalCharacter(str: string, character: string): string;
709
709
  //#endregion
710
710
  //#region src/core/utils/path.d.ts
711
711
  declare function normalizePathParameters(str: string): string;
712
+ declare function joinPaths(...segments: string[]): string;
712
713
  //#endregion
713
714
  //#region src/core/utils/object.d.ts
714
715
  declare function hasOwnProperty<X extends object, Y extends PropertyKey>(obj: X, prop: Y): obj is X & Record<Y, unknown>;
@@ -745,7 +746,7 @@ declare abstract class AbstractSpecGenerator<Spec extends SpecV2 | SpecV3, Schem
745
746
  protected buildProperties(properties: ResolverProperty[]): Record<string, Schema>;
746
747
  protected abstract markPropertyDeprecated(schema: Schema): void;
747
748
  protected shouldStripRefSiblings(): boolean;
748
- protected assignPropertyDefaults(schema: Schema, property: ResolverProperty): void;
749
+ protected assignPropertyDefaults(_schema: Schema, _property: ResolverProperty): void;
749
750
  protected buildSchemaForRefObject(referenceType: RefObjectType): Schema;
750
751
  protected abstract resolveAdditionalProperties(type: BaseType): Schema | boolean;
751
752
  protected determineTypesUsedInEnum(anEnum: Array<string | number | boolean | null>): VariableType[];
@@ -760,7 +761,7 @@ declare abstract class AbstractSpecGenerator<Spec extends SpecV2 | SpecV3, Schem
760
761
  declare class V2Generator extends AbstractSpecGenerator<SpecV2, SchemaV2> {
761
762
  build(): Promise<SpecV2>;
762
763
  private static translateSecurityDefinitions;
763
- protected resolveAdditionalProperties(type: BaseType): SchemaV2 | boolean;
764
+ protected resolveAdditionalProperties(_type: BaseType): SchemaV2 | boolean;
764
765
  protected markPropertyDeprecated(schema: SchemaV2): void;
765
766
  private buildPaths;
766
767
  private buildMethod;
@@ -790,7 +791,7 @@ declare class V3Generator extends AbstractSpecGenerator<SpecV3, SchemaV3> {
790
791
  private buildRequestBody;
791
792
  private buildMediaType;
792
793
  protected buildResponses(input: Response[]): Record<string, ResponseV3>;
793
- protected buildOperation(controllerName: string, method: Method): OperationV3;
794
+ protected buildOperation(_controllerName: string, method: Method): OperationV3;
794
795
  protected transformParameterSource(source: `${ParameterSource}`): `${ParameterSourceV3}` | undefined;
795
796
  protected buildParameter(input: Parameter): ParameterV3;
796
797
  private transformParameterExamples;
@@ -825,5 +826,5 @@ declare function generateSwagger<V extends `${Version}`>(options: Omit<SwaggerGe
825
826
  //#region src/app/save.d.ts
826
827
  declare function saveSwagger(spec: SpecV2 | SpecV3, options?: SwaggerSaveOptions): Promise<DocumentFormatData>;
827
828
  //#endregion
828
- export { AbstractSpecGenerator, ApiKeySecurity, BaseOAuthSecurityV2, BaseOperation, BaseParameter, BaseParameterV2, BaseParameterV3, BaseResponse, BaseSchema, BaseSecurity, BaseSpec, BasicSecurity, BasicSecurityV2, BasicSecurityV3, BodyParameter, BodyParameterV2, BodyParameterV3, ComponentsV3, CookieParameterV3, DataFormatName, DataTypeName, DocumentFormat, DocumentFormatData, Example, FormDataParameter, FormDataParameterV2, FormDataParameterV3, HeaderParameter, HeaderParameterV2, HeaderParameterV3, HeaderV2, HeaderV3, Info, MediaTypeV3, OAuth2AccessCodeSecurityV2, OAuth2ApplicationSecurityV2, OAuth2AuthorizationCodeFlow, OAuth2AuthorizationCodeFlowV3, OAuth2ClientCredentialsFlow, OAuth2ClientCredentialsFlowV3, OAuth2ImplicitFlow, OAuth2ImplicitFlowV3, OAuth2ImplicitSecurityV2, OAuth2PasswordFlow, OAuth2PasswordFlowV3, OAuth2PasswordSecurityV2, OAuth2Security, OAuth2SecurityV2, OAuth2SecurityV3, Oauth2BaseFlow, Oauth2BaseFlowV3, OperationV2, OperationV3, OutputForVersion, ParameterSourceV2, ParameterSourceV3, ParameterV2, ParameterV3, Path, PathParameter, PathParameterV2, PathParameterV3, PathsV3, QueryParameter, QueryParameterV2, QueryParameterV3, RequestBodyV3, ResponseV2, ResponseV3, SchemaV2, SchemaV3, SecurityDefinition, SecurityDefinitions, SecurityType, SecurityV2, SecurityV3, ServerOption, ServerV3, SpecGeneratorOptions, SpecGeneratorOptionsInput, SpecV2, SpecV3, SwaggerError, SwaggerErrorCode, SwaggerGenerateData, SwaggerGenerateOptions, SwaggerSaveOptions, TransferProtocol, V2Generator, V3Generator, ValidatorOpenApiMeta, VariableV3, Version, buildSpecGeneratorOptions, generateSwagger, hasOwnProperty, normalizePathParameters, removeDuplicateSlashes, removeFinalCharacter, saveSwagger, transformValueTo };
829
+ export { AbstractSpecGenerator, ApiKeySecurity, BaseOAuthSecurityV2, BaseOperation, BaseParameter, BaseParameterV2, BaseParameterV3, BaseResponse, BaseSchema, BaseSecurity, BaseSpec, BasicSecurity, BasicSecurityV2, BasicSecurityV3, BodyParameter, BodyParameterV2, BodyParameterV3, ComponentsV3, CookieParameterV3, DataFormatName, DataTypeName, DocumentFormat, DocumentFormatData, Example, FormDataParameter, FormDataParameterV2, FormDataParameterV3, HeaderParameter, HeaderParameterV2, HeaderParameterV3, HeaderV2, HeaderV3, Info, MediaTypeV3, OAuth2AccessCodeSecurityV2, OAuth2ApplicationSecurityV2, OAuth2AuthorizationCodeFlow, OAuth2AuthorizationCodeFlowV3, OAuth2ClientCredentialsFlow, OAuth2ClientCredentialsFlowV3, OAuth2ImplicitFlow, OAuth2ImplicitFlowV3, OAuth2ImplicitSecurityV2, OAuth2PasswordFlow, OAuth2PasswordFlowV3, OAuth2PasswordSecurityV2, OAuth2Security, OAuth2SecurityV2, OAuth2SecurityV3, Oauth2BaseFlow, Oauth2BaseFlowV3, OperationV2, OperationV3, OutputForVersion, ParameterSourceV2, ParameterSourceV3, ParameterV2, ParameterV3, Path, PathParameter, PathParameterV2, PathParameterV3, PathsV3, QueryParameter, QueryParameterV2, QueryParameterV3, RequestBodyV3, ResponseV2, ResponseV3, SchemaV2, SchemaV3, SecurityDefinition, SecurityDefinitions, SecurityType, SecurityV2, SecurityV3, ServerOption, ServerV3, SpecGeneratorOptions, SpecGeneratorOptionsInput, SpecV2, SpecV3, SwaggerError, SwaggerErrorCode, SwaggerGenerateData, SwaggerGenerateOptions, SwaggerSaveOptions, TransferProtocol, V2Generator, V3Generator, ValidatorOpenApiMeta, VariableV3, Version, buildSpecGeneratorOptions, generateSwagger, hasOwnProperty, joinPaths, normalizePathParameters, removeDuplicateSlashes, removeFinalCharacter, saveSwagger, transformValueTo };
829
830
  //# sourceMappingURL=index.d.mts.map
@@ -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,OAAA;AAAA,cAErC,cAAA;EAAA,SAGH,IAAA;EAAA,SAAA,IAAA;AAAA;AAAA,KACE,cAAA,UAAwB,cAAA,cAA4B,cAAA;AAAA,cAEnD,YAAA;EAAA;;;;;KAMD,YAAA,UAAsB,YAAA,cAA0B,YAAA;;;cCpB/C,gBAAA;EAAA;;;;;KAMD,gBAAA,UAA0B,gBAAA,cAA8B,gBAAA;AAAA,cAEvD,cAAA;EAAA;;;;;;;;;;KAWD,cAAA,UAAwB,cAAA,cAA4B,cAAA;AAAA,cAEnD,YAAA;EAAA;;;;;;;;;KAUD,YAAA,UAAsB,YAAA,cAA0B,YAAA;;;KC3BhD,QAAA;EACR,IAAA,EAAM,IAAA;EACN,IAAA,GAAO,GAAA;EACP,YAAA,GAAe,YAAA;AAAA;AAAA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AAA,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,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;;;;;KAMD,YAAA,UAAsB,YAAA,cAA0B,YAAY;;;cCpB3D,gBAAA;EAAA;;;;;KAMD,gBAAA,UAA0B,gBAAA,cAA8B,gBAAgB;AAAA,cAEvE,cAAA;EAAA;;;;;;;;;;KAWD,cAAA,UAAwB,cAAA,cAA4B,cAAc;AAAA,cAEjE,YAAA;EAAA;;;;;;;;;KAUD,YAAA,UAAsB,YAAA,cAA0B,YAAY;;;KC3B5D,QAAA;EACR,IAAA,EAAM,IAAA;EACN,IAAA,GAAO,GAAA;EACP,YAAA,GAAe,YAAA;AAAA;AAAA,KAGP,IAAA;EACR,KAAA;EACA,OAAA;EACA,WAAA;EACA,cAAA;EACA,OAAA,GAAU,OAAA;EACV,OAAA,GAAU,OAAO;AAAA;AAAA,KAGhB,OAAA;EACD,IAA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BAAA,GACV,OAAA,CAAQ,kBAAA"}
package/dist/index.mjs CHANGED
@@ -1,19 +1,16 @@
1
1
  import { BaseError } from "@ebec/core";
2
2
  import { ParameterSource, TypeName, isAnyType, isArrayType, isBinaryType, isEnumType, isIntersectionType, isMetadata, isNestedObjectLiteralType, isNeverType, isPrimitiveType, isRefAliasType, isRefEnumType, isRefObjectType, isReferenceType, isTupleType, isUndefinedType, isUnionType, isVoidType } from "@trapi/core";
3
- import path from "node:path";
4
3
  import { URL } from "node:url";
5
4
  import { isObject, merge } from "smob";
5
+ import path from "node:path";
6
6
  import fs from "node:fs";
7
7
  import process from "node:process";
8
8
  import YAML from "yamljs";
9
9
  //#region src/core/config/utils.ts
10
10
  function buildSpecGeneratorOptions(input) {
11
11
  const servers = [];
12
- if (input.servers) if (Array.isArray(input.servers)) for (let i = 0; i < input.servers.length; i++) {
13
- const server = input.servers[i];
14
- if (typeof server === "string") servers.push({ url: server });
15
- else servers.push(server);
16
- }
12
+ if (input.servers) if (Array.isArray(input.servers)) for (const server of input.servers) if (typeof server === "string") servers.push({ url: server });
13
+ else servers.push(server);
17
14
  else if (typeof input.servers === "string") servers.push({ url: input.servers });
18
15
  else servers.push(input.servers);
19
16
  return {
@@ -101,7 +98,7 @@ const DataTypeName = {
101
98
  //#endregion
102
99
  //#region src/core/utils/character.ts
103
100
  function removeDuplicateSlashes(str) {
104
- return str.replace("/([^:]$)/+/g", "$1");
101
+ return str.replace(/([^:]\/)\/+/g, "$1");
105
102
  }
106
103
  function removeFinalCharacter(str, character) {
107
104
  while (str.charAt(str.length - 1) === character && str.length > 0) str = str.slice(0, -1);
@@ -115,6 +112,12 @@ function normalizePathParameters(str) {
115
112
  str = str.replace(/<([^/]+)>/g, "{$1}");
116
113
  return str;
117
114
  }
115
+ function joinPaths(...segments) {
116
+ let result = segments.join("/").replace(/\/{2,}/g, "/");
117
+ if (!result.startsWith("/")) result = `/${result}`;
118
+ if (result.length > 1 && result.endsWith("/")) result = result.slice(0, -1);
119
+ return result;
120
+ }
118
121
  //#endregion
119
122
  //#region src/core/utils/object.ts
120
123
  function hasOwnProperty(obj, prop) {
@@ -182,8 +185,9 @@ var AbstractSpecGenerator = class {
182
185
  return {};
183
186
  }
184
187
  getSchemaForEnumType(enumType) {
185
- const type = this.decideEnumType(enumType.members);
186
- const nullable = !!enumType.members.includes(null);
188
+ const nullable = enumType.members.includes(null);
189
+ const nonNullMembers = enumType.members.filter((m) => m !== null);
190
+ const type = this.decideEnumType(nonNullMembers);
187
191
  const schema = {
188
192
  type,
189
193
  enum: enumType.members.map((member) => transformValueTo(type, member))
@@ -304,9 +308,7 @@ var AbstractSpecGenerator = class {
304
308
  }
305
309
  buildSchemasForReferenceTypes(extendFn) {
306
310
  const output = {};
307
- const keys = Object.keys(this.metadata.referenceTypes);
308
- for (const key of keys) {
309
- const referenceType = this.metadata.referenceTypes[key];
311
+ for (const referenceType of Object.values(this.metadata.referenceTypes)) {
310
312
  switch (referenceType.typeName) {
311
313
  case TypeName.REF_ALIAS:
312
314
  output[referenceType.refName] = this.buildSchemaForRefAlias(referenceType);
@@ -351,7 +353,7 @@ var AbstractSpecGenerator = class {
351
353
  shouldStripRefSiblings() {
352
354
  return true;
353
355
  }
354
- assignPropertyDefaults(schema, property) {}
356
+ assignPropertyDefaults(_schema, _property) {}
355
357
  buildSchemaForRefObject(referenceType) {
356
358
  const required = referenceType.properties.filter((p) => p.required && !this.isUndefinedProperty(p)).map((p) => p.name);
357
359
  const output = {
@@ -394,10 +396,7 @@ var AbstractSpecGenerator = class {
394
396
  }
395
397
  groupParameters(items) {
396
398
  const output = {};
397
- for (const item of items) {
398
- if (typeof output[item.in] === "undefined") output[item.in] = [];
399
- output[item.in].push(item);
400
- }
399
+ for (const item of items) (output[item.in] ?? (output[item.in] = [])).push(item);
401
400
  return output;
402
401
  }
403
402
  transformExtensions(input) {
@@ -480,8 +479,9 @@ var V2Generator = class V2Generator extends AbstractSpecGenerator {
480
479
  spec.securityDefinitions = this.config.securityDefinitions ? V2Generator.translateSecurityDefinitions(this.config.securityDefinitions) : {};
481
480
  if (this.config.consumes) spec.consumes = this.config.consumes;
482
481
  if (this.config.produces) spec.produces = this.config.produces;
483
- if (this.config.servers && this.config.servers.length > 0) {
484
- const url = new URL(this.config.servers[0].url, "http://localhost:3000/");
482
+ const firstServer = this.config.servers?.[0];
483
+ if (firstServer) {
484
+ const url = new URL(firstServer.url, "http://localhost:3000/");
485
485
  spec.host = url.host;
486
486
  if (url.pathname) spec.basePath = url.pathname;
487
487
  }
@@ -493,48 +493,44 @@ var V2Generator = class V2Generator extends AbstractSpecGenerator {
493
493
  }
494
494
  static translateSecurityDefinitions(securityDefinitions) {
495
495
  const definitions = {};
496
- const keys = Object.keys(securityDefinitions);
497
- for (const key of keys) {
498
- const securityDefinition = securityDefinitions[key];
499
- switch (securityDefinition.type) {
500
- case "http":
501
- if (securityDefinition.scheme === "basic") definitions[key] = { type: "basic" };
502
- break;
503
- case "apiKey":
504
- definitions[key] = securityDefinition;
505
- break;
506
- case "oauth2":
507
- if (securityDefinition.flows.implicit) definitions[`${key}Implicit`] = {
508
- type: "oauth2",
509
- flow: "implicit",
510
- authorizationUrl: securityDefinition.flows.implicit.authorizationUrl,
511
- scopes: securityDefinition.flows.implicit.scopes
512
- };
513
- if (securityDefinition.flows.password) definitions[`${key}Password`] = {
514
- type: "oauth2",
515
- flow: "password",
516
- tokenUrl: securityDefinition.flows.password.tokenUrl,
517
- scopes: securityDefinition.flows.password.scopes
518
- };
519
- if (securityDefinition.flows.authorizationCode) definitions[`${key}AccessCode`] = {
520
- type: "oauth2",
521
- flow: "accessCode",
522
- tokenUrl: securityDefinition.flows.authorizationCode.tokenUrl,
523
- authorizationUrl: securityDefinition.flows.authorizationCode.authorizationUrl,
524
- scopes: securityDefinition.flows.authorizationCode.scopes
525
- };
526
- if (securityDefinition.flows.clientCredentials) definitions[`${key}Application`] = {
527
- type: "oauth2",
528
- flow: "application",
529
- tokenUrl: securityDefinition.flows.clientCredentials.tokenUrl,
530
- scopes: securityDefinition.flows.clientCredentials.scopes
531
- };
532
- break;
533
- }
496
+ for (const [key, securityDefinition] of Object.entries(securityDefinitions)) switch (securityDefinition.type) {
497
+ case "http":
498
+ if (securityDefinition.scheme === "basic") definitions[key] = { type: "basic" };
499
+ break;
500
+ case "apiKey":
501
+ definitions[key] = securityDefinition;
502
+ break;
503
+ case "oauth2":
504
+ if (securityDefinition.flows.implicit) definitions[`${key}Implicit`] = {
505
+ type: "oauth2",
506
+ flow: "implicit",
507
+ authorizationUrl: securityDefinition.flows.implicit.authorizationUrl,
508
+ scopes: securityDefinition.flows.implicit.scopes
509
+ };
510
+ if (securityDefinition.flows.password) definitions[`${key}Password`] = {
511
+ type: "oauth2",
512
+ flow: "password",
513
+ tokenUrl: securityDefinition.flows.password.tokenUrl,
514
+ scopes: securityDefinition.flows.password.scopes
515
+ };
516
+ if (securityDefinition.flows.authorizationCode) definitions[`${key}AccessCode`] = {
517
+ type: "oauth2",
518
+ flow: "accessCode",
519
+ tokenUrl: securityDefinition.flows.authorizationCode.tokenUrl,
520
+ authorizationUrl: securityDefinition.flows.authorizationCode.authorizationUrl,
521
+ scopes: securityDefinition.flows.authorizationCode.scopes
522
+ };
523
+ if (securityDefinition.flows.clientCredentials) definitions[`${key}Application`] = {
524
+ type: "oauth2",
525
+ flow: "application",
526
+ tokenUrl: securityDefinition.flows.clientCredentials.tokenUrl,
527
+ scopes: securityDefinition.flows.clientCredentials.scopes
528
+ };
529
+ break;
534
530
  }
535
531
  return definitions;
536
532
  }
537
- resolveAdditionalProperties(type) {
533
+ resolveAdditionalProperties(_type) {
538
534
  return true;
539
535
  }
540
536
  markPropertyDeprecated(schema) {
@@ -552,14 +548,13 @@ var V2Generator = class V2Generator extends AbstractSpecGenerator {
552
548
  method.consumes = unique([...controller.consumes, ...method.consumes]);
553
549
  method.produces = unique([...controller.produces, ...method.produces]);
554
550
  method.tags = unique([...controller.tags, ...method.tags]);
555
- method.security = method.security || controller.security;
551
+ if (!method.security?.length) method.security = controller.security;
556
552
  method.deprecated = method.deprecated || controller.deprecated;
557
553
  method.responses = unique([...controller.responses, ...method.responses]);
558
554
  for (const controllerPath of controllerPaths) {
559
- let fullPath = path.posix.join("/", controllerPath, method.path);
560
- fullPath = normalizePathParameters(fullPath);
561
- output[fullPath] = output[fullPath] || {};
562
- output[fullPath][method.method] = this.buildMethod(method, fullPath, usedOperationIds);
555
+ const fullPath = normalizePathParameters(joinPaths(controllerPath, method.path));
556
+ const pathItem = output[fullPath] ?? (output[fullPath] = {});
557
+ pathItem[method.method] = this.buildMethod(method, fullPath, usedOperationIds);
563
558
  }
564
559
  });
565
560
  });
@@ -573,7 +568,7 @@ var V2Generator = class V2Generator extends AbstractSpecGenerator {
573
568
  if (method.summary) output.summary = method.summary;
574
569
  if (method.deprecated) output.deprecated = method.deprecated;
575
570
  if (method.tags.length) output.tags = method.tags;
576
- if (method.security) output.security = method.security;
571
+ if (method.security?.length) output.security = method.security;
577
572
  const parameters = this.groupParameters(method.parameters);
578
573
  output.parameters = [
579
574
  ...(parameters[ParameterSource.PATH] || []).filter((p) => emittedPath.includes(`{${p.name}}`)),
@@ -586,7 +581,7 @@ var V2Generator = class V2Generator extends AbstractSpecGenerator {
586
581
  message: `Only one body parameter allowed per method, but ${bodyParameters.length} found in '${method.name}'.`,
587
582
  code: SwaggerErrorCode.BODY_PARAMETER_DUPLICATE
588
583
  });
589
- const bodyParameter = bodyParameters.length > 0 ? this.buildParameter(bodyParameters[0]) : void 0;
584
+ const bodyParameter = bodyParameters[0] ? this.buildParameter(bodyParameters[0]) : void 0;
590
585
  const bodyPropParams = parameters[ParameterSource.BODY_PROP] || [];
591
586
  if (bodyPropParams.length > 0) {
592
587
  const schema = {
@@ -730,21 +725,21 @@ var V2Generator = class V2Generator extends AbstractSpecGenerator {
730
725
  typeName: TypeName.ENUM,
731
726
  members: []
732
727
  };
733
- for (let i = 0; i < type.members.length; i++) {
734
- const member = type.members[i];
728
+ for (const member of type.members) {
735
729
  if (isEnumType(member)) enumTypeMember.members.push(...member.members);
736
730
  if (!isAnyType(member) && !isUndefinedType(member) && !isNeverType(member) && !isEnumType(member)) members.push(member);
737
731
  }
738
732
  if (members.length === 0 && enumTypeMember.members.length > 0) return this.getSchemaForEnumType(enumTypeMember);
739
733
  const isNullEnum = enumTypeMember.members.every((member) => member === null);
740
734
  if (members.length === 1) {
735
+ const single = members[0];
741
736
  if (isNullEnum) {
742
- const memberType = this.getSchemaForType(members[0]);
737
+ const memberType = this.getSchemaForType(single);
743
738
  if (memberType.$ref) return memberType;
744
739
  memberType["x-nullable"] = true;
745
740
  return memberType;
746
741
  }
747
- if (enumTypeMember.members.length === 0) return this.getSchemaForType(members[0]);
742
+ if (enumTypeMember.members.length === 0) return this.getSchemaForType(single);
748
743
  }
749
744
  return {
750
745
  type: DataTypeName.OBJECT,
@@ -756,8 +751,7 @@ var V2Generator = class V2Generator extends AbstractSpecGenerator {
756
751
  operationId: this.getOperationId(method.name),
757
752
  consumes: method.consumes || [],
758
753
  produces: method.produces || [],
759
- responses: {},
760
- security: method.security || []
754
+ responses: {}
761
755
  };
762
756
  const produces = [];
763
757
  method.responses.forEach((res) => {
@@ -767,14 +761,13 @@ var V2Generator = class V2Generator extends AbstractSpecGenerator {
767
761
  else if (isBinaryType(res.schema)) produces.push("application/octet-stream");
768
762
  operation.responses[res.status].schema = this.getSchemaForType(res.schema);
769
763
  }
770
- if (res.examples && res.examples.length > 0) {
771
- const example = res.examples[0];
772
- if (example.value) operation.responses[res.status].examples = { "application/json": example.value };
773
- }
764
+ const example = res.examples?.[0];
765
+ if (example?.value) operation.responses[res.status].examples = { "application/json": example.value };
774
766
  });
775
- if (operation.consumes.length === 0) {
776
- if (method.parameters.some((parameter) => parameter.in === ParameterSource.BODY || parameter.in === ParameterSource.BODY_PROP)) operation.consumes.push("application/json");
777
- if (method.parameters.some((parameter) => parameter.in === ParameterSource.FORM_DATA)) operation.consumes.push("multipart/form-data");
767
+ const consumes = operation.consumes;
768
+ if (consumes.length === 0) {
769
+ if (method.parameters.some((parameter) => parameter.in === ParameterSource.BODY || parameter.in === ParameterSource.BODY_PROP)) consumes.push("application/json");
770
+ if (method.parameters.some((parameter) => parameter.in === ParameterSource.FORM_DATA)) consumes.push("multipart/form-data");
778
771
  }
779
772
  if (operation.produces.length === 0 && produces.length > 0) operation.produces = [...new Set(produces)];
780
773
  if (operation.produces.length === 0) operation.produces = ["application/json"];
@@ -836,39 +829,33 @@ var V3Generator = class V3Generator extends AbstractSpecGenerator {
836
829
  }
837
830
  static translateSecurityDefinitions(securityDefinitions) {
838
831
  const output = {};
839
- const keys = Object.keys(securityDefinitions);
840
- for (const key of keys) {
841
- const securityDefinition = securityDefinitions[key];
842
- switch (securityDefinition.type) {
843
- case "http":
844
- output[key] = securityDefinition;
845
- break;
846
- case "oauth2":
847
- output[key] = securityDefinition;
848
- break;
849
- case "apiKey":
850
- output[key] = securityDefinition;
851
- break;
852
- }
832
+ for (const [key, securityDefinition] of Object.entries(securityDefinitions)) switch (securityDefinition.type) {
833
+ case "http":
834
+ output[key] = securityDefinition;
835
+ break;
836
+ case "oauth2":
837
+ output[key] = securityDefinition;
838
+ break;
839
+ case "apiKey":
840
+ output[key] = securityDefinition;
841
+ break;
853
842
  }
854
843
  return output;
855
844
  }
856
845
  buildPaths() {
857
846
  const output = {};
858
847
  const usedOperationIds = /* @__PURE__ */ new Set();
859
- for (let i = 0; i < this.metadata.controllers.length; i++) {
860
- const controller = this.metadata.controllers[i];
848
+ for (const controller of this.metadata.controllers) {
861
849
  if (controller.hidden) continue;
862
850
  const controllerPaths = controller.paths.length === 0 ? [""] : controller.paths;
863
- for (let j = 0; j < controller.methods.length; j++) {
864
- const method = controller.methods[j];
851
+ for (const method of controller.methods) {
865
852
  if (method.hidden) continue;
866
853
  method.deprecated = method.deprecated || controller.deprecated;
854
+ if (!method.security?.length) method.security = controller.security;
867
855
  for (const controllerPath of controllerPaths) {
868
- let path = removeFinalCharacter(removeDuplicateSlashes(`/${controllerPath}/${method.path}`), "/");
869
- path = normalizePathParameters(path);
870
- output[path] = output[path] || {};
871
- output[path][method.method] = this.buildMethod(controller.name, method, path, usedOperationIds);
856
+ const path = normalizePathParameters(joinPaths(controllerPath, method.path));
857
+ const pathItem = output[path] ?? (output[path] = {});
858
+ pathItem[method.method] = this.buildMethod(controller.name, method, path, usedOperationIds);
872
859
  }
873
860
  }
874
861
  }
@@ -881,7 +868,7 @@ var V3Generator = class V3Generator extends AbstractSpecGenerator {
881
868
  output.tags = method.tags;
882
869
  output.operationId = uniqueOperationId(method.operationId || output.operationId, usedOperationIds);
883
870
  if (method.deprecated) output.deprecated = method.deprecated;
884
- if (method.security) output.security = method.security;
871
+ if (method.security?.length) output.security = method.security;
885
872
  const parameters = this.groupParameters(method.parameters);
886
873
  const pathParams = (parameters[ParameterSource.PATH] || []).filter((p) => emittedPath.includes(`{${p.name}}`));
887
874
  output.parameters = [
@@ -901,12 +888,13 @@ var V3Generator = class V3Generator extends AbstractSpecGenerator {
901
888
  code: SwaggerErrorCode.BODY_FORM_CONFLICT
902
889
  });
903
890
  const bodyPropParams = parameters[ParameterSource.BODY_PROP] || [];
904
- if (bodyPropParams.length > 0) {
891
+ const firstBodyProp = bodyPropParams[0];
892
+ if (firstBodyProp) {
905
893
  if (bodyParams.length === 0) bodyParams.push({
906
894
  in: ParameterSource.BODY,
907
895
  name: "body",
908
896
  description: "",
909
- parameterName: bodyPropParams[0].parameterName || "body",
897
+ parameterName: firstBodyProp.parameterName || "body",
910
898
  required: true,
911
899
  type: {
912
900
  typeName: TypeName.NESTED_OBJECT_LITERAL,
@@ -916,17 +904,19 @@ var V3Generator = class V3Generator extends AbstractSpecGenerator {
916
904
  deprecated: false,
917
905
  extensions: []
918
906
  });
919
- if (isNestedObjectLiteralType(bodyParams[0].type)) for (const bodyPropParam of bodyPropParams) bodyParams[0].type.properties.push({
907
+ const firstBody = bodyParams[0];
908
+ if (isNestedObjectLiteralType(firstBody.type)) for (const bodyPropParam of bodyPropParams) firstBody.type.properties.push({
920
909
  default: bodyPropParam.default,
921
910
  validators: bodyPropParam.validators,
922
911
  description: bodyPropParam.description,
923
912
  name: bodyPropParam.name,
924
913
  type: bodyPropParam.type,
925
914
  required: bodyPropParam.required,
926
- deprecated: bodyPropParam.deprecated
915
+ deprecated: bodyPropParam.deprecated ?? false
927
916
  });
928
917
  }
929
- if (bodyParams.length > 0) output.requestBody = this.buildRequestBody(bodyParams[0]);
918
+ const firstBodyParam = bodyParams[0];
919
+ if (firstBodyParam) output.requestBody = this.buildRequestBody(firstBodyParam);
930
920
  else if (formParams.length > 0) output.requestBody = this.buildRequestBodyWithFormData(formParams);
931
921
  Object.assign(output, this.transformExtensions(method.extensions));
932
922
  return output;
@@ -934,11 +924,9 @@ var V3Generator = class V3Generator extends AbstractSpecGenerator {
934
924
  buildRequestBodyWithFormData(parameters) {
935
925
  const required = [];
936
926
  const properties = {};
937
- const keys = Object.keys(parameters);
938
- for (let i = 0; i < parameters.length; i++) {
939
- const { schema } = this.buildMediaType(parameters[keys[i]]);
940
- properties[parameters[keys[i]].name] = schema;
941
- if (parameters[keys[i]].required) required.push(parameters[keys[i]].name);
927
+ for (const parameter of parameters) {
928
+ properties[parameter.name] = this.buildMediaType(parameter).schema;
929
+ if (parameter.required) required.push(parameter.name);
942
930
  }
943
931
  return {
944
932
  required: required.length > 0,
@@ -968,16 +956,17 @@ var V3Generator = class V3Generator extends AbstractSpecGenerator {
968
956
  const output = {};
969
957
  for (const res of input) {
970
958
  const name = res.status || "default";
971
- output[name] = { description: res.description };
959
+ const response = { description: res.description };
960
+ output[name] = response;
972
961
  if (res.schema && !isVoidType(res.schema) && !isNeverType(res.schema)) {
973
962
  const examples = {};
974
- if (res.examples && res.examples.length > 0) for (let i = 0; i < res.examples.length; i++) {
975
- const label = res.examples[i].label || `example${i + 1}`;
976
- examples[label] = { value: res.examples[i].value };
963
+ if (res.examples) for (const [i, ex] of res.examples.entries()) {
964
+ const label = ex.label || `example${i + 1}`;
965
+ examples[label] = { value: ex.value };
977
966
  }
978
- output[name].content = output[name].content || {};
967
+ const content = response.content ?? (response.content = {});
979
968
  const contentTypes = res.produces || ["application/json"];
980
- for (const contentType of contentTypes) output[name].content[contentType] = {
969
+ for (const contentType of contentTypes) content[contentType] = {
981
970
  schema: this.getSchemaForType(res.schema),
982
971
  ...Object.keys(examples).length > 0 && { examples }
983
972
  };
@@ -995,18 +984,18 @@ var V3Generator = class V3Generator extends AbstractSpecGenerator {
995
984
  required: each.required
996
985
  };
997
986
  });
998
- output[res.name].headers = headers;
987
+ response.headers = headers;
999
988
  }
1000
989
  }
1001
990
  return output;
1002
991
  }
1003
- buildOperation(controllerName, method) {
992
+ buildOperation(_controllerName, method) {
1004
993
  const operation = {
1005
994
  operationId: this.getOperationId(method.name),
1006
995
  responses: this.buildResponses(method.responses)
1007
996
  };
1008
997
  if (method.description) operation.description = method.description;
1009
- if (method.security) operation.security = method.security;
998
+ if (method.security?.length) operation.security = method.security;
1010
999
  if (method.deprecated) operation.deprecated = method.deprecated;
1011
1000
  return operation;
1012
1001
  }
@@ -1038,35 +1027,37 @@ var V3Generator = class V3Generator extends AbstractSpecGenerator {
1038
1027
  Object.assign(parameter, this.transformExtensions(input.extensions));
1039
1028
  if (input.deprecated) parameter.deprecated = true;
1040
1029
  const parameterType = this.getSchemaForType(input.type);
1041
- if (parameterType.format) parameter.schema.format = parameterType.format;
1030
+ const schema = parameter.schema;
1031
+ if (parameterType.format) schema.format = parameterType.format;
1042
1032
  if (parameterType.$ref) {
1043
1033
  parameter.schema = parameterType;
1044
1034
  return parameter;
1045
1035
  }
1046
- if (isAnyType(input.type)) parameter.schema.type = DataTypeName.STRING;
1036
+ if (isAnyType(input.type)) schema.type = DataTypeName.STRING;
1047
1037
  else {
1048
- if (parameterType.type) parameter.schema.type = parameterType.type;
1049
- parameter.schema.items = parameterType.items;
1050
- parameter.schema.enum = parameterType.enum;
1038
+ if (parameterType.type) schema.type = parameterType.type;
1039
+ schema.items = parameterType.items;
1040
+ schema.enum = parameterType.enum;
1051
1041
  }
1052
1042
  parameter.examples = this.transformParameterExamples(input);
1053
1043
  return parameter;
1054
1044
  }
1055
1045
  transformParameterExamples(parameter) {
1056
1046
  const output = {};
1057
- if (parameter.examples && parameter.examples.length > 0) for (let i = 0; i < parameter.examples.length; i++) {
1058
- const label = parameter.examples[i].label || `example${i + 1}`;
1059
- output[label] = { value: parameter.examples[i].value };
1047
+ if (parameter.examples) for (const [i, ex] of parameter.examples.entries()) {
1048
+ const label = ex.label || `example${i + 1}`;
1049
+ output[label] = { value: ex.value };
1060
1050
  }
1061
1051
  return output;
1062
1052
  }
1063
1053
  buildServers() {
1064
1054
  const servers = [];
1065
- for (let i = 0; i < this.config.servers.length; i++) {
1066
- const url = new URL(this.config.servers[i].url, "http://localhost:3000/");
1055
+ const configured = this.config.servers ?? [];
1056
+ for (const entry of configured) {
1057
+ const url = new URL(entry.url, "http://localhost:3000/");
1067
1058
  servers.push({
1068
1059
  url: `${url.protocol}//${url.host}${url.pathname || ""}`,
1069
- ...this.config.servers[i].description ? { description: this.config.servers[i].description } : {}
1060
+ ...entry.description ? { description: entry.description } : {}
1070
1061
  });
1071
1062
  }
1072
1063
  return servers;
@@ -1116,19 +1107,14 @@ var V3Generator = class V3Generator extends AbstractSpecGenerator {
1116
1107
  const members = [];
1117
1108
  let nullable = false;
1118
1109
  const enumMembers = {};
1119
- for (let i = 0; i < type.members.length; i++) {
1120
- const member = type.members[i];
1121
- if (isEnumType(member)) for (let j = 0; j < member.members.length; j++) {
1122
- const memberChild = member.members[j];
1110
+ for (const member of type.members) {
1111
+ if (isEnumType(member)) for (const memberChild of member.members) {
1123
1112
  if (memberChild === null || memberChild === void 0) {
1124
1113
  nullable = true;
1125
1114
  continue;
1126
1115
  }
1127
1116
  const typeOf = typeof memberChild;
1128
- if (typeOf === "string" || typeOf === "number" || typeOf === "boolean") {
1129
- enumMembers[typeOf] = enumMembers[typeOf] || [];
1130
- enumMembers[typeOf].push(memberChild);
1131
- }
1117
+ if (typeOf === "string" || typeOf === "number" || typeOf === "boolean") (enumMembers[typeOf] ?? (enumMembers[typeOf] = [])).push(memberChild);
1132
1118
  }
1133
1119
  if (!isAnyType(member) && !isUndefinedType(member) && !isNeverType(member) && !isEnumType(member)) members.push(member);
1134
1120
  }
@@ -1304,6 +1290,6 @@ async function saveSwagger(spec, options = {}) {
1304
1290
  };
1305
1291
  }
1306
1292
  //#endregion
1307
- export { AbstractSpecGenerator, DataFormatName, DataTypeName, DocumentFormat, ParameterSourceV2, ParameterSourceV3, SecurityType, SwaggerError, SwaggerErrorCode, TransferProtocol, V2Generator, V3Generator, Version, buildSpecGeneratorOptions, generateSwagger, hasOwnProperty, normalizePathParameters, removeDuplicateSlashes, removeFinalCharacter, saveSwagger, transformValueTo };
1293
+ export { AbstractSpecGenerator, DataFormatName, DataTypeName, DocumentFormat, ParameterSourceV2, ParameterSourceV3, SecurityType, SwaggerError, SwaggerErrorCode, TransferProtocol, V2Generator, V3Generator, Version, buildSpecGeneratorOptions, generateSwagger, hasOwnProperty, joinPaths, normalizePathParameters, removeDuplicateSlashes, removeFinalCharacter, saveSwagger, transformValueTo };
1308
1294
 
1309
1295
  //# sourceMappingURL=index.mjs.map
@@ -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 (let i = 0; i < input.servers.length; i++) {\n const server = input.servers[i];\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 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 * 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 type = this.decideEnumType(enumType.members);\n const nullable = !!enumType.members.includes(null);\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 const keys = Object.keys(this.metadata.referenceTypes);\n for (const key of keys) {\n const referenceType = this.metadata.referenceTypes[key];\n\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 // eslint-disable-next-line @typescript-eslint/no-unused-vars\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 if (typeof output[item.in] === 'undefined') {\n output[item.in] = [];\n }\n\n output[item.in].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 path from 'node:path';\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 { 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 if (\n this.config.servers &&\n this.config.servers.length > 0\n ) {\n const url = new URL(this.config.servers[0].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 const keys = Object.keys(securityDefinitions);\n for (const key of keys) {\n const securityDefinition = securityDefinitions[key];\n\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 // eslint-disable-next-line @typescript-eslint/no-unused-vars\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 method.security = method.security || controller.security;\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 let fullPath = path.posix.join('/', controllerPath, method.path);\n fullPath = normalizePathParameters(fullPath);\n\n output[fullPath] = output[fullPath] || {};\n output[fullPath][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) {\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.length > 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 (let i = 0; i < type.members.length; i++) {\n const member = type.members[i];\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 if (isNullEnum) {\n const memberType = this.getSchemaForType(members[0]);\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(members[0]);\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 security: method.security || [],\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 if (\n res.examples &&\n res.examples.length > 0\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\n if (operation.consumes.length === 0) {\n const hasBody = method.parameters\n .some((parameter) => parameter.in === ParameterSource.BODY || parameter.in === ParameterSource.BODY_PROP);\n if (hasBody) {\n operation.consumes.push('application/json');\n }\n\n const hasFormData = method.parameters\n .some((parameter) => parameter.in === ParameterSource.FORM_DATA);\n if (hasFormData) {\n operation.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 { SecurityDefinition, SecurityDefinitions } from '../../../core/types';\nimport { SwaggerError, SwaggerErrorCode } from '../../../core/error';\nimport {\n normalizePathParameters,\n removeDuplicateSlashes,\n removeFinalCharacter,\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 const keys = Object.keys(securityDefinitions);\n for (const key of keys) {\n const securityDefinition : SecurityDefinition = securityDefinitions[key];\n\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 (let i = 0; i < this.metadata.controllers.length; i++) {\n const controller = this.metadata.controllers[i];\n if (controller.hidden) {\n continue;\n }\n\n const controllerPaths = controller.paths.length === 0 ? [''] : controller.paths;\n\n for (let j = 0; j < controller.methods.length; j++) {\n const method = controller.methods[j];\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 for (const controllerPath of controllerPaths) {\n let path = removeFinalCharacter(\n removeDuplicateSlashes(`/${controllerPath}/${method.path}`),\n '/',\n );\n path = normalizePathParameters(path);\n\n output[path] = output[path] || {};\n output[path][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) {\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 if (bodyPropParams.length > 0) {\n if (bodyParams.length === 0) {\n bodyParams.push({\n in: ParameterSource.BODY,\n name: 'body',\n description: '',\n parameterName: bodyPropParams[0].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 if (isNestedObjectLiteralType(bodyParams[0].type)) {\n for (const bodyPropParam of bodyPropParams) {\n bodyParams[0].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,\n });\n }\n }\n }\n\n if (bodyParams.length > 0) {\n output.requestBody = this.buildRequestBody(bodyParams[0]);\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 const keys = Object.keys(parameters);\n for (let i = 0; i < parameters.length; i++) {\n const { schema } = this.buildMediaType(parameters[keys[i]]);\n properties[parameters[keys[i]].name] = schema;\n\n if (parameters[keys[i]].required) {\n required.push(parameters[keys[i]].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 output[name] = { description: res.description };\n\n if (\n res.schema &&\n !isVoidType(res.schema) &&\n !isNeverType(res.schema)\n ) {\n const examples : Record<string, Example> = {};\n if (\n res.examples &&\n res.examples.length > 0\n ) {\n for (let i = 0; i < res.examples.length; i++) {\n const label = res.examples[i].label || `example${i + 1}`;\n examples[label] = { value: res.examples[i].value };\n }\n }\n\n output[name].content = output[name].content || {};\n\n const contentTypes = res.produces || ['application/json'];\n for (const contentType of contentTypes) {\n output[name].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 output[res.name].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) {\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 if (parameterType.format) {\n parameter.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 parameter.schema.type = DataTypeName.STRING;\n } else {\n if (parameterType.type) {\n parameter.schema.type = parameterType.type as DataTypeName;\n }\n parameter.schema.items = parameterType.items;\n parameter.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 (\n parameter.examples &&\n parameter.examples.length > 0\n ) {\n for (let i = 0; i < parameter.examples.length; i++) {\n const label = parameter.examples[i].label || `example${i + 1}`;\n output[label] = { value: parameter.examples[i].value };\n }\n }\n\n return output;\n }\n\n private buildServers() : ServerV3[] {\n const servers = [];\n for (let i = 0; i < this.config.servers.length; i++) {\n const url = new URL(this.config.servers[i].url, 'http://localhost:3000/');\n servers.push({\n url: `${url.protocol}//${url.host}${url.pathname || ''}`,\n ...(this.config.servers[i].description ? { description: this.config.servers[i].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 (let i = 0; i < type.members.length; i++) {\n const member = type.members[i];\n if (isEnumType(member)) {\n for (let j = 0; j < member.members.length; j++) {\n const memberChild = member.members[j];\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 enumMembers[typeOf] = enumMembers[typeOf] || [];\n enumMembers[typeOf].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":";;;;;;;;;AASA,SAAgB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G,SAAS,MAAM,KAAK,EAAE,WAAW,MAAM,CAAC;CAEjD,MAAM,UAAU,UAAU,MAAM,OAAO;AACvC,OAAM,GAAG,SAAS,UAAU,UAAU,SAAS,EAAE,UAAU,SAAS,CAAC;AAErE,QAAO;EACH,MAAM;EACN;EACA;EACH"}
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":";;;;;;;;;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,QAAQ,KAAK,MAAM,OAAO;CAIlC,OAAO;EACH,GAAG;EACH;CACJ;AACJ;;;ACxBA,MAAa,UAAU;CACnB,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,MAAM;AACV;AAGA,MAAa,iBAAiB;CAC1B,MAAM;CACN,MAAM;AAC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AC;CAEL,MAAM,4BAA4B,4BAA4B,OAAO;CAErE,QAAQ,QAAQ,SAAhB;EACI,KAAK,QAAQ;EACb,KAAK,QAAQ;EACb,KAAK,QAAQ,MAGT,OAAO,MAAM,IAFS,YAAY,UAAU,2BAA2B,QAAQ,OAE1D,EAAE,MAAM;EAEjC,SAGI,OAAO,MAAM,IAFS,YAAY,UAAU,yBAEvB,EAAE,MAAM;CAErC;AACJ;;;AC9CA,MAAM,oBAAoB;AAE1B,SAAS,gBAAgB,MAA0B,QAAqC;CAEpF,OAAO,IADO,QAAQ,WAAW,QAAQ,mBAAmB,EAC/C,EAAE,GAAG;AACtB;AAEA,SAAS,UAAU,MAAuB,QAAqC;CAC3E,IAAI,WAAW,eAAe,MAC1B,OAAO,KAAK,UAAU,MAAM,GAAI;CAEpC,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC;AACvC;AAEA,eAAsB,YAClB,MACA,UAA8B,CAAC,GACJ;CAC3B,MAAM,SAA8B,QAAQ,UAAU,eAAe;CAErE,IAAI,MAAM,QAAQ,IAAI;CACtB,IAAI,QAAQ,KACR,MAAM,KAAK,WAAW,QAAQ,GAAG,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"}
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.0-beta.4",
9
+ "version": "2.0.1",
10
10
  "description": "Generate Swagger files from a decorator APIs.",
11
11
  "keywords": [
12
12
  "typescript",
@@ -36,20 +36,20 @@
36
36
  "scripts": {
37
37
  "build": "npm run build:js && npm run build:types",
38
38
  "build:js": "tsdown",
39
- "build:types": "tsc -p tsconfig.build.json",
39
+ "build:types": "tsc -p tsconfig.build.json && tsc -p tsconfig.test.json",
40
40
  "test": "vitest --config ./test/vitest.config.ts --run",
41
41
  "test:coverage": "vitest --config ./test/vitest.config.ts --run --coverage",
42
42
  "preblushOnly": "npm run build"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/yamljs": "^0.2.34",
46
- "jsonata": "^2.0.6",
47
- "locter": "^2.1.6"
46
+ "jsonata": "^2.2.1",
47
+ "locter": "^3.0.0"
48
48
  },
49
49
  "dependencies": {
50
- "@ebec/core": "^1.0.1",
51
- "@trapi/core": "2.0.0-beta.4",
52
- "smob": "^1.5.0",
50
+ "@ebec/core": "^1.1.0",
51
+ "@trapi/core": "2.0.1",
52
+ "smob": "^1.6.2",
53
53
  "yamljs": "^0.3.0"
54
54
  },
55
55
  "repository": {