next-openapi-gen 1.3.0 → 1.4.0

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/README.md CHANGED
@@ -276,19 +276,20 @@ Version guidance:
276
276
 
277
277
  ### Important options
278
278
 
279
- | Option | Purpose |
280
- | ------------------------------------- | ---------------------------------------------------------------- |
281
- | `openapi` | Target `3.0.0`, `3.1.0`, or `3.2.0` output |
282
- | `apiDir` | Route directory to scan |
283
- | `routerType` | `"app"` or `"pages"` |
284
- | `schemaDir` | Directory or directories to search for schemas/types |
285
- | `schemaType` | `"zod"`, `"typescript"`, or both |
286
- | `schemaFiles` | YAML/JSON OpenAPI fragments to merge into the generated document |
287
- | `includeOpenApiRoutes` | Only include handlers tagged with `@openapi` |
288
- | `ignoreRoutes` | Exclude routes with wildcard support |
289
- | `defaultResponseSet` / `responseSets` | Reusable error-response groups |
290
- | `errorConfig` | Shared error schema templates |
291
- | `authPresets` | Override or extend the `@auth` keyword → scheme-name mapping |
279
+ | Option | Purpose |
280
+ | ------------------------------------- | --------------------------------------------------------------------------------------- |
281
+ | `openapi` | Target `3.0.0`, `3.1.0`, or `3.2.0` output |
282
+ | `apiDir` | Route directory to scan |
283
+ | `routerType` | `"app"` or `"pages"` |
284
+ | `schemaDir` | Directory or directories to search for schemas/types |
285
+ | `schemaType` | `"zod"`, `"typescript"`, or both |
286
+ | `schemaFiles` | YAML/JSON OpenAPI fragments to merge into the generated document |
287
+ | `includeOpenApiRoutes` | Only include handlers tagged with `@openapi` |
288
+ | `ignoreRoutes` | Exclude routes with wildcard support |
289
+ | `excludeSchemas` | Exclude internal schemas from `components/schemas` by name or glob (e.g. `["*Params"]`) |
290
+ | `defaultResponseSet` / `responseSets` | Reusable error-response groups |
291
+ | `errorConfig` | Shared error schema templates |
292
+ | `authPresets` | Override or extend the `@auth` keyword → scheme-name mapping |
292
293
 
293
294
  For a fuller setup guide, Pages Router notes, response sets, and route exclusion
294
295
  patterns, see [docs/getting-started.md](./docs/getting-started.md).
@@ -315,6 +316,7 @@ patterns, see [docs/getting-started.md](./docs/getting-started.md).
315
316
  | `@openapi` | Explicit inclusion marker when `includeOpenApiRoutes` is enabled |
316
317
  | `@openapi-override` | Deep-merge extra OpenAPI fields onto the operation |
317
318
  | `@ignore` | Exclude a route from generation |
319
+ | `@internal` | Exclude a schema/type declaration from `components/schemas` |
318
320
  | `@method` | Required HTTP method tag for Pages Router handlers |
319
321
 
320
322
  For the complete tag guide and usage recipes, see
package/dist/cli.js CHANGED
@@ -588,122 +588,6 @@ import fse2 from "fs-extra";
588
588
  import path16 from "path";
589
589
  import fs12 from "fs";
590
590
 
591
- // ../openapi-core/dist/config/normalize.js
592
- function normalizeRouterType(routerType) {
593
- return routerType ?? DEFAULT_ROUTER_TYPE;
594
- }
595
- function normalizeSchemaTypes(schemaType) {
596
- const schemaBackends = Array.isArray(schemaType) ? schemaType : [schemaType ?? DEFAULT_RUNTIME_SCHEMA_TYPE];
597
- return [...new Set(schemaBackends)];
598
- }
599
- function normalizeOpenApiVersion(template) {
600
- if (template.openapi.startsWith("3.2")) {
601
- return "3.2";
602
- }
603
- if (template.openapi.startsWith("3.1")) {
604
- return "3.1";
605
- }
606
- if (template.openapi.startsWith("4.")) {
607
- return "4.0";
608
- }
609
- return DEFAULT_OPENAPI_VERSION;
610
- }
611
- function normalizeFrameworkKind(kind) {
612
- switch (kind) {
613
- case FrameworkKind.Nextjs:
614
- case "next":
615
- return FrameworkKind.Nextjs;
616
- case FrameworkKind.Tanstack:
617
- case "tanstack":
618
- return FrameworkKind.Tanstack;
619
- case FrameworkKind.ReactRouter:
620
- case "react-router":
621
- return FrameworkKind.ReactRouter;
622
- default:
623
- return FrameworkKind.Nextjs;
624
- }
625
- }
626
- function normalizeFramework(config2, routerType) {
627
- if (config2.framework) {
628
- const frameworkKind = normalizeFrameworkKind(config2.framework.kind);
629
- switch (frameworkKind) {
630
- case FrameworkKind.Nextjs:
631
- return {
632
- ...config2.framework,
633
- kind: frameworkKind,
634
- router: config2.framework.router || routerType,
635
- modulePath: config2.framework.modulePath || config2.framework.adapterPath || config2.next?.adapterPath,
636
- adapterPath: config2.framework.adapterPath || config2.next?.adapterPath
637
- };
638
- case FrameworkKind.Tanstack:
639
- case FrameworkKind.ReactRouter:
640
- return {
641
- ...config2.framework,
642
- kind: frameworkKind,
643
- modulePath: config2.framework.modulePath || config2.framework.adapterPath
644
- };
645
- }
646
- }
647
- return {
648
- kind: FrameworkKind.Nextjs,
649
- router: routerType,
650
- modulePath: config2.next?.adapterPath,
651
- adapterPath: config2.next?.adapterPath
652
- };
653
- }
654
- function normalizeOpenApiConfig(template) {
655
- const routerType = normalizeRouterType(template.routerType);
656
- const schemaBackends = normalizeSchemaTypes(template.schemaType);
657
- const openapiVersion = normalizeOpenApiVersion({
658
- openapi: "openapi" in template ? template.openapi || "3.0.0" : "3.0.0"
659
- });
660
- return {
661
- apiDir: template.apiDir ?? DEFAULT_API_DIR,
662
- routerType,
663
- schemaDir: template.schemaDir ?? DEFAULT_SCHEMA_DIR,
664
- docsUrl: template.docsUrl ?? DEFAULT_DOCS_URL,
665
- ui: template.ui ?? DEFAULT_UI,
666
- outputFile: template.outputFile ?? DEFAULT_GENERATED_OPENAPI_FILENAME,
667
- outputDir: template.outputDir ?? DEFAULT_OUTPUT_DIR,
668
- includeOpenApiRoutes: template.includeOpenApiRoutes ?? DEFAULT_INCLUDE_OPENAPI_ROUTES,
669
- ignoreRoutes: template.ignoreRoutes ?? [],
670
- excludeSchemas: template.excludeSchemas ?? [],
671
- schemaType: template.schemaType ?? DEFAULT_RUNTIME_SCHEMA_TYPE,
672
- schemaBackends,
673
- schemaFiles: template.schemaFiles ?? [],
674
- defaultResponseSet: template.defaultResponseSet,
675
- responseSets: template.responseSets,
676
- errorConfig: template.errorConfig,
677
- errorDefinitions: template.errorDefinitions,
678
- openapiVersion,
679
- framework: normalizeFramework(template, routerType),
680
- next: {
681
- adapterPath: template.next?.adapterPath
682
- },
683
- diagnostics: template.diagnostics ?? { enabled: DEFAULT_DIAGNOSTICS_ENABLED },
684
- debug: template.debug ?? DEFAULT_DEBUG
685
- };
686
- }
687
-
688
- // ../openapi-core/dist/diagnostics/collector.js
689
- var DiagnosticsCollector = class {
690
- diagnostics = [];
691
- add(diagnostic) {
692
- this.diagnostics.push(diagnostic);
693
- }
694
- getAll() {
695
- return [...this.diagnostics];
696
- }
697
- hasAny() {
698
- return this.diagnostics.length > 0;
699
- }
700
- };
701
-
702
- // ../openapi-core/dist/openapi/document.js
703
- function createDocumentFromTemplate(template) {
704
- return structuredClone(template);
705
- }
706
-
707
591
  // ../openapi-core/dist/shared/utils.js
708
592
  import { parse } from "@babel/parser";
709
593
  import * as t from "@babel/types";
@@ -1039,7 +923,7 @@ function parseJSDocBlock(commentValue, filePath) {
1039
923
  result.cookieType = extractTypeFromComment(normalizedComment, "@cookie");
1040
924
  const authValue = extractLineValue(normalizedComment, "@auth");
1041
925
  if (authValue) {
1042
- result.auth = performAuthPresetReplacements(authValue);
926
+ result.auth = authValue;
1043
927
  }
1044
928
  const querystring = parseQuerystringTag(normalizedComment);
1045
929
  if (querystring) {
@@ -1715,16 +1599,17 @@ var INTERNAL_OPENAPI_CONFIG_KEYS = [
1715
1599
  "next",
1716
1600
  "diagnostics",
1717
1601
  "debug",
1602
+ "authPresets",
1718
1603
  "excludeSchemas"
1719
1604
  ];
1720
- var AUTH_PRESET_REPLACEMENTS = {
1605
+ var DEFAULT_AUTH_PRESET_REPLACEMENTS = {
1721
1606
  bearer: "BearerAuth",
1722
1607
  basic: "BasicAuth",
1723
1608
  apikey: "ApiKeyAuth"
1724
1609
  };
1725
- function performAuthPresetReplacements(authValue) {
1610
+ function performAuthPresetReplacements(authValue, presets = DEFAULT_AUTH_PRESET_REPLACEMENTS) {
1726
1611
  const authParts = authValue.split(",").map((part) => part.trim());
1727
- const mappedParts = authParts.map((part) => AUTH_PRESET_REPLACEMENTS[part.toLowerCase()] || part);
1612
+ const mappedParts = authParts.map((part) => presets[part.toLowerCase()] || part);
1728
1613
  return mappedParts.join(",");
1729
1614
  }
1730
1615
  function getOperationId(routePath, method) {
@@ -1742,6 +1627,123 @@ function parseTypeScriptFile(content, options) {
1742
1627
  });
1743
1628
  }
1744
1629
 
1630
+ // ../openapi-core/dist/config/normalize.js
1631
+ function normalizeRouterType(routerType) {
1632
+ return routerType ?? DEFAULT_ROUTER_TYPE;
1633
+ }
1634
+ function normalizeSchemaTypes(schemaType) {
1635
+ const schemaBackends = Array.isArray(schemaType) ? schemaType : [schemaType ?? DEFAULT_RUNTIME_SCHEMA_TYPE];
1636
+ return [...new Set(schemaBackends)];
1637
+ }
1638
+ function normalizeOpenApiVersion(template) {
1639
+ if (template.openapi.startsWith("3.2")) {
1640
+ return "3.2";
1641
+ }
1642
+ if (template.openapi.startsWith("3.1")) {
1643
+ return "3.1";
1644
+ }
1645
+ if (template.openapi.startsWith("4.")) {
1646
+ return "4.0";
1647
+ }
1648
+ return DEFAULT_OPENAPI_VERSION;
1649
+ }
1650
+ function normalizeFrameworkKind(kind) {
1651
+ switch (kind) {
1652
+ case FrameworkKind.Nextjs:
1653
+ case "next":
1654
+ return FrameworkKind.Nextjs;
1655
+ case FrameworkKind.Tanstack:
1656
+ case "tanstack":
1657
+ return FrameworkKind.Tanstack;
1658
+ case FrameworkKind.ReactRouter:
1659
+ case "react-router":
1660
+ return FrameworkKind.ReactRouter;
1661
+ default:
1662
+ return FrameworkKind.Nextjs;
1663
+ }
1664
+ }
1665
+ function normalizeFramework(config2, routerType) {
1666
+ if (config2.framework) {
1667
+ const frameworkKind = normalizeFrameworkKind(config2.framework.kind);
1668
+ switch (frameworkKind) {
1669
+ case FrameworkKind.Nextjs:
1670
+ return {
1671
+ ...config2.framework,
1672
+ kind: frameworkKind,
1673
+ router: config2.framework.router || routerType,
1674
+ modulePath: config2.framework.modulePath || config2.framework.adapterPath || config2.next?.adapterPath,
1675
+ adapterPath: config2.framework.adapterPath || config2.next?.adapterPath
1676
+ };
1677
+ case FrameworkKind.Tanstack:
1678
+ case FrameworkKind.ReactRouter:
1679
+ return {
1680
+ ...config2.framework,
1681
+ kind: frameworkKind,
1682
+ modulePath: config2.framework.modulePath || config2.framework.adapterPath
1683
+ };
1684
+ }
1685
+ }
1686
+ return {
1687
+ kind: FrameworkKind.Nextjs,
1688
+ router: routerType,
1689
+ modulePath: config2.next?.adapterPath,
1690
+ adapterPath: config2.next?.adapterPath
1691
+ };
1692
+ }
1693
+ function normalizeOpenApiConfig(template) {
1694
+ const routerType = normalizeRouterType(template.routerType);
1695
+ const schemaBackends = normalizeSchemaTypes(template.schemaType);
1696
+ const openapiVersion = normalizeOpenApiVersion({
1697
+ openapi: "openapi" in template ? template.openapi || "3.0.0" : "3.0.0"
1698
+ });
1699
+ return {
1700
+ apiDir: template.apiDir ?? DEFAULT_API_DIR,
1701
+ routerType,
1702
+ schemaDir: template.schemaDir ?? DEFAULT_SCHEMA_DIR,
1703
+ docsUrl: template.docsUrl ?? DEFAULT_DOCS_URL,
1704
+ ui: template.ui ?? DEFAULT_UI,
1705
+ outputFile: template.outputFile ?? DEFAULT_GENERATED_OPENAPI_FILENAME,
1706
+ outputDir: template.outputDir ?? DEFAULT_OUTPUT_DIR,
1707
+ includeOpenApiRoutes: template.includeOpenApiRoutes ?? DEFAULT_INCLUDE_OPENAPI_ROUTES,
1708
+ ignoreRoutes: template.ignoreRoutes ?? [],
1709
+ excludeSchemas: template.excludeSchemas ?? [],
1710
+ schemaType: template.schemaType ?? DEFAULT_RUNTIME_SCHEMA_TYPE,
1711
+ schemaBackends,
1712
+ schemaFiles: template.schemaFiles ?? [],
1713
+ defaultResponseSet: template.defaultResponseSet,
1714
+ responseSets: template.responseSets,
1715
+ errorConfig: template.errorConfig,
1716
+ errorDefinitions: template.errorDefinitions,
1717
+ openapiVersion,
1718
+ framework: normalizeFramework(template, routerType),
1719
+ next: {
1720
+ adapterPath: template.next?.adapterPath
1721
+ },
1722
+ diagnostics: template.diagnostics ?? { enabled: DEFAULT_DIAGNOSTICS_ENABLED },
1723
+ authPresets: { ...DEFAULT_AUTH_PRESET_REPLACEMENTS, ...template.authPresets },
1724
+ debug: template.debug ?? DEFAULT_DEBUG
1725
+ };
1726
+ }
1727
+
1728
+ // ../openapi-core/dist/diagnostics/collector.js
1729
+ var DiagnosticsCollector = class {
1730
+ diagnostics = [];
1731
+ add(diagnostic) {
1732
+ this.diagnostics.push(diagnostic);
1733
+ }
1734
+ getAll() {
1735
+ return [...this.diagnostics];
1736
+ }
1737
+ hasAny() {
1738
+ return this.diagnostics.length > 0;
1739
+ }
1740
+ };
1741
+
1742
+ // ../openapi-core/dist/openapi/document.js
1743
+ function createDocumentFromTemplate(template) {
1744
+ return structuredClone(template);
1745
+ }
1746
+
1745
1747
  // ../openapi-core/dist/openapi/version-processor.js
1746
1748
  var DefaultOpenApiVersionProcessor = class {
1747
1749
  id;
@@ -2200,8 +2202,10 @@ function downgradeSchemaForOpenApi30(schema, mediaTypeName) {
2200
2202
  const nullableBranch = nextSchema.anyOf.find((item) => item.type === "null");
2201
2203
  const baseBranch = nextSchema.anyOf.find((item) => item.type !== "null");
2202
2204
  if (nullableBranch && baseBranch) {
2205
+ const { anyOf: _anyOf, ...outerMeta } = nextSchema;
2203
2206
  nextSchema = {
2204
2207
  ...structuredClone(baseBranch),
2208
+ ...outerMeta,
2205
2209
  nullable: true
2206
2210
  };
2207
2211
  }
@@ -4116,7 +4120,7 @@ function processZodLiteral(node, context) {
4116
4120
  return { type: "string", enum: [arg.value] };
4117
4121
  }
4118
4122
  if (t8.isNumericLiteral(arg)) {
4119
- return { type: "number", enum: [arg.value] };
4123
+ return { type: Number.isInteger(arg.value) ? "integer" : "number", enum: [arg.value] };
4120
4124
  }
4121
4125
  if (t8.isBooleanLiteral(arg)) {
4122
4126
  return { type: "boolean", enum: [arg.value] };
@@ -4132,7 +4136,7 @@ function processZodLiteral(node, context) {
4132
4136
  if (typeof value === "string")
4133
4137
  return { type: "string", enum: [value] };
4134
4138
  if (typeof value === "number")
4135
- return { type: "number", enum: [value] };
4139
+ return { type: Number.isInteger(value) ? "integer" : "number", enum: [value] };
4136
4140
  if (typeof value === "boolean")
4137
4141
  return { type: "boolean", enum: [value] };
4138
4142
  if (value === null)
@@ -4227,7 +4231,7 @@ function processZodTuple(node, processNode, context) {
4227
4231
  if (t8.isIdentifier(node.arguments[0]) && context?.resolveConstArrayValues) {
4228
4232
  const values = context.resolveConstArrayValues(node.arguments[0].name);
4229
4233
  if (values && values.length > 0) {
4230
- const prefixItems = values.map((value) => typeof value === "number" ? { type: "number", enum: [value] } : { type: "string", enum: [value] });
4234
+ const prefixItems = values.map((value) => typeof value === "number" ? { type: Number.isInteger(value) ? "integer" : "number", enum: [value] } : { type: "string", enum: [value] });
4231
4235
  return {
4232
4236
  type: "array",
4233
4237
  prefixItems,
@@ -4271,7 +4275,7 @@ function processZodUnion(node, processNode, context) {
4271
4275
  if (t8.isIdentifier(node.arguments[0]) && context?.resolveConstArrayValues) {
4272
4276
  const values = context.resolveConstArrayValues(node.arguments[0].name);
4273
4277
  if (values && values.length > 0) {
4274
- const type = typeof values[0] === "number" ? "number" : "string";
4278
+ const type = typeof values[0] === "number" ? Number.isInteger(values[0]) ? "integer" : "number" : "string";
4275
4279
  return { type, enum: values };
4276
4280
  }
4277
4281
  }
@@ -11718,8 +11722,17 @@ var ZodRuntimeExporter = class {
11718
11722
  return node.arguments[0] ? literal(this.buildLiteralValue(node.arguments[0])) : null;
11719
11723
  case "enum":
11720
11724
  return this.buildEnum(node);
11721
- case "array":
11722
- return node.arguments[0] && isProcessableNode(node.arguments[0]) ? array(this.buildSchema(node.arguments[0]) ?? unknown()) : array(unknown());
11725
+ case "array": {
11726
+ const arg = node.arguments[0];
11727
+ if (!arg || !isProcessableNode(arg)) {
11728
+ return array(unknown());
11729
+ }
11730
+ const itemSchema = this.buildSchema(arg);
11731
+ if (!itemSchema) {
11732
+ return null;
11733
+ }
11734
+ return array(itemSchema);
11735
+ }
11723
11736
  case "strictObject": {
11724
11737
  const base = this.buildObject(node);
11725
11738
  return base && typeof base.strict === "function" ? base.strict() : base;
@@ -11851,13 +11864,17 @@ var ZodRuntimeExporter = class {
11851
11864
  if (node.arguments.length === 0 || !t9.isArrayExpression(node.arguments[0])) {
11852
11865
  return tuple([]);
11853
11866
  }
11854
- const items = node.arguments[0].elements.flatMap((element) => {
11867
+ const items = [];
11868
+ for (const element of node.arguments[0].elements) {
11855
11869
  if (!isProcessableNode(element)) {
11856
- return [];
11870
+ return null;
11857
11871
  }
11858
11872
  const schema = this.buildSchema(element);
11859
- return schema ? [schema] : [];
11860
- });
11873
+ if (!schema) {
11874
+ return null;
11875
+ }
11876
+ items.push(schema);
11877
+ }
11861
11878
  return tuple(items);
11862
11879
  }
11863
11880
  buildTemplateLiteral(node) {
@@ -12469,7 +12486,12 @@ var ZodSchemaConverter = class {
12469
12486
  if (this.isZodSchema(path25.node.init)) {
12470
12487
  const schema = this.processZodNode(path25.node.init);
12471
12488
  if (schema) {
12472
- this.storeResolvedSchema(schemaName, schema);
12489
+ const overrideId = this.extractMetaIdFromNode(path25.node.init);
12490
+ if (overrideId) {
12491
+ this.applyMetaIdOverride(schemaName, schema, overrideId, filePath);
12492
+ } else {
12493
+ this.storeResolvedSchema(schemaName, schema);
12494
+ }
12473
12495
  }
12474
12496
  return;
12475
12497
  }
@@ -12812,8 +12834,15 @@ var ZodSchemaConverter = class {
12812
12834
  };
12813
12835
  switch (methodName) {
12814
12836
  case "optional":
12837
+ break;
12815
12838
  case "nullable":
12816
12839
  case "nullish":
12840
+ schema = {
12841
+ anyOf: [
12842
+ { $ref: `#/components/schemas/${this.getSchemaReferenceName(schemaName)}` },
12843
+ { type: "null" }
12844
+ ]
12845
+ };
12817
12846
  break;
12818
12847
  case "describe":
12819
12848
  if (node.arguments.length > 0 && t10.isStringLiteral(node.arguments[0])) {
@@ -13331,12 +13360,16 @@ var ZodSchemaConverter = class {
13331
13360
  case "optional":
13332
13361
  break;
13333
13362
  case "nullable":
13334
- if (!schema.allOf) {
13363
+ if (schema.allOf) {
13364
+ schema = { anyOf: [...schema.allOf, { type: "null" }] };
13365
+ } else {
13335
13366
  schema.nullable = true;
13336
13367
  }
13337
13368
  break;
13338
13369
  case "nullish":
13339
- if (!schema.allOf) {
13370
+ if (schema.allOf) {
13371
+ schema = { anyOf: [...schema.allOf, { type: "null" }] };
13372
+ } else {
13340
13373
  schema.nullable = true;
13341
13374
  }
13342
13375
  break;
@@ -13851,6 +13884,9 @@ var ZodSchemaConverter = class {
13851
13884
  if (!this.getStoredSchema(schemaName)) {
13852
13885
  logger.debug(`Pre-processing Zod schema: ${schemaName}`);
13853
13886
  this.processingSchemas.add(schemaName);
13887
+ this.currentFilePath = filePath;
13888
+ this.currentAST = ast;
13889
+ this.currentImports = importedModules;
13854
13890
  const schema = this.processZodNode(declaration.init);
13855
13891
  this.processingSchemas.delete(schemaName);
13856
13892
  if (schema) {
@@ -13883,6 +13919,9 @@ var ZodSchemaConverter = class {
13883
13919
  if (!this.getStoredSchema(schemaName) && !this.processingSchemas.has(schemaName)) {
13884
13920
  logger.debug(`Pre-processing Zod schema: ${schemaName}`);
13885
13921
  this.processingSchemas.add(schemaName);
13922
+ this.currentFilePath = filePath;
13923
+ this.currentAST = ast;
13924
+ this.currentImports = importedModules;
13886
13925
  const schema = this.processZodNode(declaration.init);
13887
13926
  this.processingSchemas.delete(schemaName);
13888
13927
  if (schema) {
@@ -16753,11 +16792,16 @@ var ResponseProcessor = class {
16753
16792
  var OperationProcessor = class {
16754
16793
  schemaProcessor;
16755
16794
  responseProcessor;
16795
+ authPresets;
16756
16796
  performanceProfile;
16757
- constructor(schemaProcessor, responseProcessor, performanceProfile) {
16797
+ constructor(schemaProcessor, responseProcessor, options = {}) {
16758
16798
  this.schemaProcessor = schemaProcessor;
16759
16799
  this.responseProcessor = responseProcessor;
16760
- this.performanceProfile = performanceProfile;
16800
+ this.authPresets = {
16801
+ ...DEFAULT_AUTH_PRESET_REPLACEMENTS,
16802
+ ...options.authPresets
16803
+ };
16804
+ this.performanceProfile = options.performanceProfile;
16761
16805
  }
16762
16806
  processOperation(varName, routePath, dataTypes, pathParamNames = []) {
16763
16807
  const method = varName.toLowerCase();
@@ -16782,9 +16826,10 @@ var OperationProcessor = class {
16782
16826
  definition.deprecated = true;
16783
16827
  }
16784
16828
  if (explicitSecurity && explicitSecurity.length > 0) {
16785
- definition.security = explicitSecurity;
16829
+ definition.security = explicitSecurity.map((req) => Object.fromEntries(Object.entries(req).map(([scheme, scopes]) => [this.applyPreset(scheme), scopes])));
16786
16830
  } else if (auth) {
16787
- const authItems = auth.split(",").map((item) => item.trim());
16831
+ const mapped = performAuthPresetReplacements(auth, this.authPresets);
16832
+ const authItems = mapped.split(",").map((item) => item.trim());
16788
16833
  definition.security = authItems.map((authItem) => ({
16789
16834
  [authItem]: []
16790
16835
  }));
@@ -16997,6 +17042,9 @@ ${suffix}`;
16997
17042
  response.links[link.name] = linkObject;
16998
17043
  }
16999
17044
  }
17045
+ applyPreset(scheme) {
17046
+ return this.authPresets[scheme.toLowerCase()] ?? scheme;
17047
+ }
17000
17048
  createQuerystringParameter(dataTypes) {
17001
17049
  if (!dataTypes.querystringType) {
17002
17050
  return void 0;
@@ -17085,7 +17133,10 @@ var RouteProcessor = class {
17085
17133
  return new RegExp(`^${regexPattern}$`);
17086
17134
  });
17087
17135
  this.responseProcessor = new ResponseProcessor(this.config, this.schemaProcessor);
17088
- this.operationProcessor = new OperationProcessor(this.schemaProcessor, this.responseProcessor, this.performanceProfile);
17136
+ this.operationProcessor = new OperationProcessor(this.schemaProcessor, this.responseProcessor, {
17137
+ authPresets: this.config.authPresets,
17138
+ performanceProfile: this.performanceProfile
17139
+ });
17089
17140
  }
17090
17141
  processResponsesFromConfig(dataTypes, method) {
17091
17142
  return this.responseProcessor.processResponses(dataTypes, method);