orval 8.10.0 → 8.12.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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as description, i as startWatcher, l as name, n as loadConfigFile, r as generateSpec, s as normalizeOptions, t as findConfigFile, u as version } from "../config-Cuc_7Hju.mjs";
2
+ import { c as description, i as startWatcher, l as name, n as loadConfigFile, r as generateSpec, s as normalizeOptions, t as findConfigFile, u as version } from "../config-C7iZzhig.mjs";
3
3
  import path from "node:path";
4
4
  import { Option, program } from "@commander-js/extra-typings";
5
5
  import { ErrorWithTag, OutputClient, OutputMode, SupportedFormatter, getWarningCount, isString, log, logError, resetWarnings, setVerbose, startMessage } from "@orval/core";
@@ -10,7 +10,7 @@ const orvalMessage = startMessage({
10
10
  description
11
11
  });
12
12
  const cli = program.name("orval").description("Instantly generate TypeScript clients from your OpenAPI specification").version(version);
13
- cli.addOption(new Option("-o, --output <path>", "output file destination").conflicts(["config", "project"])).addOption(new Option("-i, --input <path>", "input file (yaml or json openapi specs)").conflicts(["config", "project"])).addOption(new Option("-c, --config <path>", "override flags by a config file").conflicts(["input", "output"])).addOption(new Option("-p, --project <name...>", "focus one or more projects of the config").conflicts(["input", "output"])).addOption(new Option("-m, --mode <name>", "default mode that will be used").choices(Object.values(OutputMode))).option("-w, --watch [paths...]", "Watch mode, if path is not specified, it watches the input target").addOption(new Option("--client <name>", "default client that will be used").choices(Object.values(OutputClient))).option("--mock", "activate the mock").option("--clean [paths...]", "Clean output directory").addOption(new Option("--formatter <name>", "Format generated files (prettier, biome, oxfmt)").choices(Object.values(SupportedFormatter))).option("--tsconfig <path>", "path to your tsconfig file").option("--verbose", "Enable verbose logging").option("--fail-on-warnings", "Exit with error code 1 when warnings are emitted").action(async (options) => {
13
+ cli.addOption(new Option("-o, --output <path>", "output file destination").conflicts(["config", "project"])).addOption(new Option("-i, --input <path>", "input file (yaml or json openapi specs)").conflicts(["config", "project"])).addOption(new Option("-c, --config <path>", "override flags by a config file").conflicts(["input", "output"])).addOption(new Option("-p, --project <name...>", "focus one or more projects of the config").conflicts(["input", "output"])).addOption(new Option("-m, --mode <name>", "default mode that will be used").choices(Object.values(OutputMode))).option("-w, --watch [paths...]", "Watch mode, if path is not specified, it watches the input target").addOption(new Option("--client <name>", "default client that will be used").choices(Object.values(OutputClient))).option("--mock", "activate mock generation (msw handlers + faker factories)").option("--clean [paths...]", "Clean output directory").addOption(new Option("--formatter <name>", "Format generated files (prettier, biome, oxfmt)").choices(Object.values(SupportedFormatter))).option("--tsconfig <path>", "path to your tsconfig file").option("--verbose", "Enable verbose logging").option("--fail-on-warnings", "Exit with error code 1 when warnings are emitted").action(async (options) => {
14
14
  if (options.verbose) setVerbose(true);
15
15
  resetWarnings();
16
16
  log(orvalMessage);
@@ -1 +1 @@
1
- {"version":3,"file":"orval.mjs","names":["pkg.name","pkg.version","pkg.description"],"sources":["../../src/bin/orval.ts"],"sourcesContent":["#!/usr/bin/env node\nimport path from 'node:path';\n\nimport { Option, program } from '@commander-js/extra-typings';\nimport {\n ErrorWithTag,\n getWarningCount,\n isString,\n log,\n logError,\n OutputClient,\n OutputMode,\n resetWarnings,\n setVerbose,\n startMessage,\n SupportedFormatter,\n} from '@orval/core';\n\nimport pkg from '../../package.json';\nimport { generateSpec } from '../generate-spec';\nimport { findConfigFile, loadConfigFile } from '../utils/config';\nimport { normalizeOptions } from '../utils/options';\nimport { startWatcher } from '../utils/watcher';\n\nconst orvalMessage = startMessage({\n name: pkg.name,\n version: pkg.version,\n description: pkg.description,\n});\nconst cli = program\n .name('orval')\n .description(\n 'Instantly generate TypeScript clients from your OpenAPI specification',\n )\n .version(pkg.version);\n\ncli\n .addOption(\n new Option('-o, --output <path>', 'output file destination').conflicts([\n 'config',\n 'project',\n ]),\n )\n .addOption(\n new Option(\n '-i, --input <path>',\n 'input file (yaml or json openapi specs)',\n ).conflicts(['config', 'project']),\n )\n .addOption(\n new Option(\n '-c, --config <path>',\n 'override flags by a config file',\n ).conflicts(['input', 'output']),\n )\n .addOption(\n new Option(\n '-p, --project <name...>',\n 'focus one or more projects of the config',\n ).conflicts(['input', 'output']),\n )\n .addOption(\n new Option('-m, --mode <name>', 'default mode that will be used').choices(\n Object.values(OutputMode),\n ),\n )\n .option(\n '-w, --watch [paths...]',\n 'Watch mode, if path is not specified, it watches the input target',\n )\n .addOption(\n new Option('--client <name>', 'default client that will be used').choices(\n Object.values(OutputClient),\n ),\n )\n .option('--mock', 'activate the mock')\n .option('--clean [paths...]', 'Clean output directory')\n .addOption(\n new Option(\n '--formatter <name>',\n 'Format generated files (prettier, biome, oxfmt)',\n ).choices(Object.values(SupportedFormatter)),\n )\n .option('--tsconfig <path>', 'path to your tsconfig file')\n .option('--verbose', 'Enable verbose logging')\n .option(\n '--fail-on-warnings',\n 'Exit with error code 1 when warnings are emitted',\n )\n .action(async (options) => {\n if (options.verbose) {\n setVerbose(true);\n }\n\n resetWarnings();\n log(orvalMessage);\n\n if (isString(options.input) && isString(options.output)) {\n const normalizedOptions = await normalizeOptions({\n input: options.input,\n output: {\n target: options.output,\n clean: options.clean,\n formatter: options.formatter,\n mock: options.mock,\n client: options.client,\n mode: options.mode,\n tsconfig: options.tsconfig,\n },\n });\n\n try {\n await generateSpec(process.cwd(), normalizedOptions);\n } catch (error) {\n if (error instanceof ErrorWithTag) {\n logError(error.cause, error.tag);\n } else {\n logError(error);\n }\n process.exit(1);\n }\n\n if (options.watch) {\n await startWatcher(\n options.watch,\n async () => {\n resetWarnings();\n try {\n await generateSpec(process.cwd(), normalizedOptions);\n } catch (error) {\n logError(error);\n process.exit(1);\n }\n if (options.failOnWarnings && getWarningCount() > 0) {\n logError(\n `Process exited with ${getWarningCount()} warning(s) due to --fail-on-warnings flag`,\n );\n process.exit(1);\n }\n },\n normalizedOptions.input.target as string,\n );\n }\n } else {\n const configFilePath = findConfigFile(options.config);\n const workspace = path.dirname(configFilePath);\n const configFile = await loadConfigFile(configFilePath);\n\n const missingProjects = options.project?.filter(\n (p) => !Object.hasOwn(configFile, p),\n );\n\n if (missingProjects?.length) {\n logError(`Project not found in config: ${missingProjects.join(', ')}`);\n process.exit(1);\n }\n\n const configs = Object.entries(configFile).filter(\n ([projectName]) =>\n // only filter by project if specified\n !Array.isArray(options.project) ||\n options.project.includes(projectName),\n );\n\n let hasErrors = false;\n for (const [projectName, config] of configs) {\n const normalizedOptions = await normalizeOptions(\n config,\n workspace,\n options,\n );\n\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n hasErrors = true;\n logError(error, projectName);\n }\n\n if (options.watch !== undefined) {\n const fileToWatch = isString(normalizedOptions.input.target)\n ? normalizedOptions.input.target\n : undefined;\n\n await startWatcher(\n options.watch,\n async () => {\n resetWarnings();\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n logError(error, projectName);\n }\n if (options.failOnWarnings && getWarningCount() > 0) {\n logError(\n `Process exited with ${getWarningCount()} warning(s) due to --fail-on-warnings flag`,\n );\n process.exit(1);\n }\n },\n fileToWatch,\n );\n }\n }\n\n if (hasErrors) {\n logError('One or more project failed, see above for details');\n process.exit(1);\n }\n }\n\n if (options.failOnWarnings && getWarningCount() > 0) {\n logError(\n `Process exited with ${getWarningCount()} warning(s) due to --fail-on-warnings flag`,\n );\n process.exit(1);\n }\n });\n\nawait cli.parseAsync(process.argv);\n"],"mappings":";;;;;;AAwBA,MAAM,eAAe,aAAa;CAC1BA;CACGC;CACIC;CACd,CAAC;AACF,MAAM,MAAM,QACT,KAAK,QAAQ,CACb,YACC,wEACD,CACA,QAAQD,QAAY;AAEvB,IACG,UACC,IAAI,OAAO,uBAAuB,0BAA0B,CAAC,UAAU,CACrE,UACA,UACD,CAAC,CACH,CACA,UACC,IAAI,OACF,sBACA,0CACD,CAAC,UAAU,CAAC,UAAU,UAAU,CAAC,CACnC,CACA,UACC,IAAI,OACF,uBACA,kCACD,CAAC,UAAU,CAAC,SAAS,SAAS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BAAkB,iBAAiB,GAAG,GAAG;AACnD,WACE,uBAAuB,iBAAiB,CAAC,4CAC1C;AACD,UAAQ,KAAK,EAAE;;EAEjB;AAEJ,MAAM,IAAI,WAAW,QAAQ,KAAK"}
1
+ {"version":3,"file":"orval.mjs","names":["pkg.name","pkg.version","pkg.description"],"sources":["../../src/bin/orval.ts"],"sourcesContent":["#!/usr/bin/env node\nimport path from 'node:path';\n\nimport { Option, program } from '@commander-js/extra-typings';\nimport {\n ErrorWithTag,\n getWarningCount,\n isString,\n log,\n logError,\n OutputClient,\n OutputMode,\n resetWarnings,\n setVerbose,\n startMessage,\n SupportedFormatter,\n} from '@orval/core';\n\nimport pkg from '../../package.json';\nimport { generateSpec } from '../generate-spec';\nimport { findConfigFile, loadConfigFile } from '../utils/config';\nimport { normalizeOptions } from '../utils/options';\nimport { startWatcher } from '../utils/watcher';\n\nconst orvalMessage = startMessage({\n name: pkg.name,\n version: pkg.version,\n description: pkg.description,\n});\nconst cli = program\n .name('orval')\n .description(\n 'Instantly generate TypeScript clients from your OpenAPI specification',\n )\n .version(pkg.version);\n\ncli\n .addOption(\n new Option('-o, --output <path>', 'output file destination').conflicts([\n 'config',\n 'project',\n ]),\n )\n .addOption(\n new Option(\n '-i, --input <path>',\n 'input file (yaml or json openapi specs)',\n ).conflicts(['config', 'project']),\n )\n .addOption(\n new Option(\n '-c, --config <path>',\n 'override flags by a config file',\n ).conflicts(['input', 'output']),\n )\n .addOption(\n new Option(\n '-p, --project <name...>',\n 'focus one or more projects of the config',\n ).conflicts(['input', 'output']),\n )\n .addOption(\n new Option('-m, --mode <name>', 'default mode that will be used').choices(\n Object.values(OutputMode),\n ),\n )\n .option(\n '-w, --watch [paths...]',\n 'Watch mode, if path is not specified, it watches the input target',\n )\n .addOption(\n new Option('--client <name>', 'default client that will be used').choices(\n Object.values(OutputClient),\n ),\n )\n .option('--mock', 'activate mock generation (msw handlers + faker factories)')\n .option('--clean [paths...]', 'Clean output directory')\n .addOption(\n new Option(\n '--formatter <name>',\n 'Format generated files (prettier, biome, oxfmt)',\n ).choices(Object.values(SupportedFormatter)),\n )\n .option('--tsconfig <path>', 'path to your tsconfig file')\n .option('--verbose', 'Enable verbose logging')\n .option(\n '--fail-on-warnings',\n 'Exit with error code 1 when warnings are emitted',\n )\n .action(async (options) => {\n if (options.verbose) {\n setVerbose(true);\n }\n\n resetWarnings();\n log(orvalMessage);\n\n if (isString(options.input) && isString(options.output)) {\n const normalizedOptions = await normalizeOptions({\n input: options.input,\n output: {\n target: options.output,\n clean: options.clean,\n formatter: options.formatter,\n mock: options.mock,\n client: options.client,\n mode: options.mode,\n tsconfig: options.tsconfig,\n },\n });\n\n try {\n await generateSpec(process.cwd(), normalizedOptions);\n } catch (error) {\n if (error instanceof ErrorWithTag) {\n logError(error.cause, error.tag);\n } else {\n logError(error);\n }\n process.exit(1);\n }\n\n if (options.watch) {\n await startWatcher(\n options.watch,\n async () => {\n resetWarnings();\n try {\n await generateSpec(process.cwd(), normalizedOptions);\n } catch (error) {\n logError(error);\n process.exit(1);\n }\n if (options.failOnWarnings && getWarningCount() > 0) {\n logError(\n `Process exited with ${getWarningCount()} warning(s) due to --fail-on-warnings flag`,\n );\n process.exit(1);\n }\n },\n normalizedOptions.input.target as string,\n );\n }\n } else {\n const configFilePath = findConfigFile(options.config);\n const workspace = path.dirname(configFilePath);\n const configFile = await loadConfigFile(configFilePath);\n\n const missingProjects = options.project?.filter(\n (p) => !Object.hasOwn(configFile, p),\n );\n\n if (missingProjects?.length) {\n logError(`Project not found in config: ${missingProjects.join(', ')}`);\n process.exit(1);\n }\n\n const configs = Object.entries(configFile).filter(\n ([projectName]) =>\n // only filter by project if specified\n !Array.isArray(options.project) ||\n options.project.includes(projectName),\n );\n\n let hasErrors = false;\n for (const [projectName, config] of configs) {\n const normalizedOptions = await normalizeOptions(\n config,\n workspace,\n options,\n );\n\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n hasErrors = true;\n logError(error, projectName);\n }\n\n if (options.watch !== undefined) {\n const fileToWatch = isString(normalizedOptions.input.target)\n ? normalizedOptions.input.target\n : undefined;\n\n await startWatcher(\n options.watch,\n async () => {\n resetWarnings();\n try {\n await generateSpec(workspace, normalizedOptions, projectName);\n } catch (error) {\n logError(error, projectName);\n }\n if (options.failOnWarnings && getWarningCount() > 0) {\n logError(\n `Process exited with ${getWarningCount()} warning(s) due to --fail-on-warnings flag`,\n );\n process.exit(1);\n }\n },\n fileToWatch,\n );\n }\n }\n\n if (hasErrors) {\n logError('One or more project failed, see above for details');\n process.exit(1);\n }\n }\n\n if (options.failOnWarnings && getWarningCount() > 0) {\n logError(\n `Process exited with ${getWarningCount()} warning(s) due to --fail-on-warnings flag`,\n );\n process.exit(1);\n }\n });\n\nawait cli.parseAsync(process.argv);\n"],"mappings":";;;;;;AAwBA,MAAM,eAAe,aAAa;CAC1BA;CACGC;CACIC;CACd,CAAC;AACF,MAAM,MAAM,QACT,KAAK,QAAQ,CACb,YACC,wEACD,CACA,QAAQD,QAAY;AAEvB,IACG,UACC,IAAI,OAAO,uBAAuB,0BAA0B,CAAC,UAAU,CACrE,UACA,UACD,CAAC,CACH,CACA,UACC,IAAI,OACF,sBACA,0CACD,CAAC,UAAU,CAAC,UAAU,UAAU,CAAC,CACnC,CACA,UACC,IAAI,OACF,uBACA,kCACD,CAAC,UAAU,CAAC,SAAS,SAAS,CAAC,CACjC,CACA,UACC,IAAI,OACF,2BACA,2CACD,CAAC,UAAU,CAAC,SAAS,SAAS,CAAC,CACjC,CACA,UACC,IAAI,OAAO,qBAAqB,iCAAiC,CAAC,QAChE,OAAO,OAAO,WAAW,CAC1B,CACF,CACA,OACC,0BACA,oEACD,CACA,UACC,IAAI,OAAO,mBAAmB,mCAAmC,CAAC,QAChE,OAAO,OAAO,aAAa,CAC5B,CACF,CACA,OAAO,UAAU,4DAA4D,CAC7E,OAAO,sBAAsB,yBAAyB,CACtD,UACC,IAAI,OACF,sBACA,kDACD,CAAC,QAAQ,OAAO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AAK,KAAK,GAAG;AACtE,WAAQ,KAAK,EAAE;;EAGjB,MAAM,UAAU,OAAO,QAAQ,WAAW,CAAC,QACxC,CAAC,iBAEA,CAAC,MAAM,QAAQ,QAAQ,QAAQ,IAC/B,QAAQ,QAAQ,SAAS,YAAY,CACxC;EAED,IAAI,YAAY;AAChB,OAAK,MAAM,CAAC,aAAa,WAAW,SAAS;GAC3C,MAAM,oBAAoB,MAAM,iBAC9B,QACA,WACA,QACD;AAED,OAAI;AACF,UAAM,aAAa,WAAW,mBAAmB,YAAY;YACtD,OAAO;AACd,gBAAY;AACZ,aAAS,OAAO,YAAY;;AAG9B,OAAI,QAAQ,UAAU,KAAA,GAAW;IAC/B,MAAM,cAAc,SAAS,kBAAkB,MAAM,OAAO,GACxD,kBAAkB,MAAM,SACxB,KAAA;AAEJ,UAAM,aACJ,QAAQ,OACR,YAAY;AACV,oBAAe;AACf,SAAI;AACF,YAAM,aAAa,WAAW,mBAAmB,YAAY;cACtD,OAAO;AACd,eAAS,OAAO,YAAY;;AAE9B,SAAI,QAAQ,kBAAkB,iBAAiB,GAAG,GAAG;AACnD,eACE,uBAAuB,iBAAiB,CAAC,4CAC1C;AACD,cAAQ,KAAK,EAAE;;OAGnB,YACD;;;AAIL,MAAI,WAAW;AACb,YAAS,oDAAoD;AAC7D,WAAQ,KAAK,EAAE;;;AAInB,KAAI,QAAQ,kBAAkB,iBAAiB,GAAG,GAAG;AACnD,WACE,uBAAuB,iBAAiB,CAAC,4CAC1C;AACD,UAAQ,KAAK,EAAE;;EAEjB;AAEJ,MAAM,IAAI,WAAW,QAAQ,KAAK"}
@@ -1,11 +1,11 @@
1
1
  import path from "node:path";
2
- import { FormDataArrayHandling, GetterPropType, NamingConvention, OutputClient, OutputHttpClient, OutputMode, PropertySortOrder, RefComponentSuffix, SupportedFormatter, asyncReduce, collectReferencedComponents, conventionName, createSuccessMessage, dynamicImport, fixCrossDirectoryImports, fixRegularSchemaImports, generateComponentDefinition, generateDependencyImports, generateParameterDefinition, generateSchemasDefinition, generateVerbsOptions, getBaseUrlRuntimeImports, getFileInfo, getFullRoute, getMockFileExtensionByTypeName, getRoute, isBoolean, isFunction, isNullish, isObject, isReference, isString, isUrl, jsDoc, log, logError, logVerbose, logWarning, pascal, removeFilesAndEmptyFolders, resolveInstalledVersions, resolveRef, splitSchemasByType, upath, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode } from "@orval/core";
2
+ import { FormDataArrayHandling, GetterPropType, NamingConvention, OutputClient, OutputHttpClient, OutputMockType, OutputMode, PropertySortOrder, RefComponentSuffix, SupportedFormatter, asyncReduce, collectReferencedComponents, conventionName, createSuccessMessage, dynamicImport, fixCrossDirectoryImports, fixRegularSchemaImports, generateComponentDefinition, generateDependencyImports, generateParameterDefinition, generateSchemasDefinition, generateVerbsOptions, getBaseUrlRuntimeImports, getFileInfo, getFullRoute, getMockFileExtensionByTypeName, getRoute, isBoolean, isFunction, isNullish, isObject, isReference, isString, isUrl, jsDoc, log, logError, logVerbose, logWarning, pascal, removeFilesAndEmptyFolders, resolveInstalledVersions, resolveRef, splitSchemasByType, upath, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode } from "@orval/core";
3
3
  import { bundle } from "@scalar/json-magic/bundle";
4
4
  import { fetchUrls, parseJson, parseYaml, readFiles } from "@scalar/json-magic/bundle/plugins/node";
5
5
  import { upgrade, validate } from "@scalar/openapi-parser";
6
6
  import { isNullish as isNullish$1, pick, unique } from "remeda";
7
7
  import * as mock from "@orval/mock";
8
- import { DEFAULT_MOCK_OPTIONS, generateMockImports } from "@orval/mock";
8
+ import { generateMockImports, getDefaultMockOptionsForType } from "@orval/mock";
9
9
  import angular from "@orval/angular";
10
10
  import axios from "@orval/axios";
11
11
  import fetchClient from "@orval/fetch";
@@ -28,7 +28,7 @@ import { createJiti } from "jiti";
28
28
  //#region package.json
29
29
  var name = "orval";
30
30
  var description = "A swagger client generator for typescript";
31
- var version = "8.10.0";
31
+ var version = "8.12.1";
32
32
  //#endregion
33
33
  //#region src/client.ts
34
34
  const DEFAULT_CLIENT = OutputClient.AXIOS;
@@ -73,7 +73,7 @@ const generateClientImports = ({ client, implementation, imports, projectName, h
73
73
  const { dependencies } = getGeneratorClient(client, output);
74
74
  return generateDependencyImports(implementation, dependencies ? [...dependencies(hasGlobalMutator, hasParamsSerializerOptions, packageJson, output.httpClient, hasTagsMutator, output.override), ...imports] : imports, projectName, hasSchemaDir, isAllowSyntheticDefaultImports);
75
75
  };
76
- const generateClientHeader = ({ outputClient = DEFAULT_CLIENT, isRequestOptions, isGlobalMutator, isMutator, provideIn, hasAwaitedType, titles, output, verbOptions, tag, clientImplementation }) => {
76
+ const generateClientHeader = ({ outputClient = DEFAULT_CLIENT, isRequestOptions, isGlobalMutator, isMutator, provideIn, hasAwaitedType, titles, output, verbOptions, tag, isDefaultTagBucket, clientImplementation }) => {
77
77
  const { header } = getGeneratorClient(outputClient, output);
78
78
  return {
79
79
  implementation: header ? header({
@@ -86,6 +86,7 @@ const generateClientHeader = ({ outputClient = DEFAULT_CLIENT, isRequestOptions,
86
86
  output,
87
87
  verbOptions,
88
88
  tag,
89
+ isDefaultTagBucket,
89
90
  clientImplementation
90
91
  }) : "",
91
92
  implementationMock: `export const ${titles.implementationMock} = () => [\n`
@@ -139,17 +140,21 @@ const generateClientTitle = ({ outputClient = DEFAULT_CLIENT, title, customTitle
139
140
  implementationMock: `get${pascal(title)}Mock`
140
141
  };
141
142
  };
142
- const generateMock = (verbOption, options) => {
143
- if (!options.mock) return {
144
- implementation: {
145
- function: "",
146
- handler: "",
147
- handlerName: ""
148
- },
149
- imports: []
150
- };
151
- if (isFunction(options.mock)) return options.mock(verbOption, options);
152
- return mock.generateMock(verbOption, options);
143
+ /**
144
+ * Invokes the underlying mock generator (msw, faker, or a user-provided
145
+ * ClientMockBuilder) for a single generator entry. Returns the standard
146
+ * `ClientMockGeneratorBuilder` shape (function/handler/handlerName +
147
+ * imports) regardless of which generator handled it.
148
+ */
149
+ const invokeMockGenerator = (verbOption, options, entry) => {
150
+ if (isFunction(entry)) return entry(verbOption, {
151
+ ...options,
152
+ mock: entry
153
+ });
154
+ return mock.generateMock(verbOption, {
155
+ ...options,
156
+ mock: entry
157
+ });
153
158
  };
154
159
  const generateOperations = (outputClient = DEFAULT_CLIENT, verbsOptions, options, output) => {
155
160
  const baseUrlImports = getBaseUrlRuntimeImports(output.baseUrl);
@@ -157,7 +162,14 @@ const generateOperations = (outputClient = DEFAULT_CLIENT, verbsOptions, options
157
162
  const { client: generatorClient } = getGeneratorClient(outputClient, output);
158
163
  const client = await generatorClient(verbOption, options, outputClient, output);
159
164
  if (!client.implementation) return acc;
160
- const generatedMock = generateMock(verbOption, options);
165
+ const mockOutputs = output.mock.generators.map((entry) => {
166
+ const generated = invokeMockGenerator(verbOption, options, entry);
167
+ return {
168
+ type: isFunction(entry) ? OutputMockType.MSW : entry.type,
169
+ implementation: generated.implementation,
170
+ imports: generated.imports
171
+ };
172
+ });
161
173
  const hasImplementation = client.implementation.trim().length > 0;
162
174
  const preferredOperationKey = verbOption.operationName;
163
175
  const baseOperationKey = verbOption.operationId ? `${verbOption.operationId}::${verbOption.operationName}` : verbOption.operationName;
@@ -170,14 +182,14 @@ const generateOperations = (outputClient = DEFAULT_CLIENT, verbsOptions, options
170
182
  acc[operationKey] = {
171
183
  implementation: hasImplementation ? (client.docComment ?? verbOption.doc) + client.implementation : client.implementation,
172
184
  imports: [...baseUrlImports, ...client.imports],
173
- implementationMock: generatedMock.implementation,
174
- importsMock: generatedMock.imports,
185
+ mockOutputs,
175
186
  tags: verbOption.tags,
176
187
  mutator: verbOption.mutator,
177
188
  clientMutators: client.mutators,
178
189
  formData: verbOption.formData,
179
190
  formUrlEncoded: verbOption.formUrlEncoded,
180
191
  paramsSerializer: verbOption.paramsSerializer,
192
+ paramsFilter: verbOption.paramsFilter,
181
193
  operationName: verbOption.operationName,
182
194
  fetchReviver: verbOption.fetchReviver
183
195
  };
@@ -225,7 +237,6 @@ async function getApiBuilder({ input, output, context }) {
225
237
  pathRoute,
226
238
  override: output.override,
227
239
  context,
228
- mock: output.mock,
229
240
  output: output.target
230
241
  }, output);
231
242
  for (const verbOption of verbsOptions) acc.verbOptions[verbOption.operationId] = verbOption;
@@ -271,7 +282,7 @@ function filterSpecComponents(spec, input) {
271
282
  };
272
283
  }
273
284
  async function importOpenApi({ spec, input, output, target, workspace, projectName }) {
274
- const filteredSpec = filterSpecComponents(await applyTransformer(spec, input.override.transformer, workspace, input.unsafeDisableValidation), input);
285
+ const filteredSpec = filterSpecComponents(spec, input);
275
286
  const schemas = getApiSchemas({
276
287
  input,
277
288
  output,
@@ -298,16 +309,6 @@ async function importOpenApi({ spec, input, output, target, workspace, projectNa
298
309
  spec: filteredSpec
299
310
  };
300
311
  }
301
- async function applyTransformer(openApi, transformer, workspace, unsafeDisableValidation = false) {
302
- const transformerFn = transformer ? await dynamicImport(transformer, workspace) : void 0;
303
- if (!transformerFn) return openApi;
304
- const transformedOpenApi = transformerFn(openApi);
305
- if (!unsafeDisableValidation) {
306
- const { valid, errors } = await validate(transformedOpenApi);
307
- if (!valid) throw new Error(`Validation failed`, { cause: errors });
308
- }
309
- return transformedOpenApi;
310
- }
311
312
  function getApiSchemas({ input, output, target, workspace, spec }) {
312
313
  const context = {
313
314
  target,
@@ -330,7 +331,7 @@ function getApiSchemas({ input, output, target, workspace, spec }) {
330
331
  }
331
332
  //#endregion
332
333
  //#region src/import-specs.ts
333
- async function resolveSpec(input, parserOptions, unsafeDisableValidation = false) {
334
+ async function resolveSpec(input, { parserOptions, transformer, workspace, unsafeDisableValidation = false }) {
334
335
  const dereferencedData = dereferenceExternalRef(await bundle(input, {
335
336
  plugins: [
336
337
  readFiles(),
@@ -340,19 +341,34 @@ async function resolveSpec(input, parserOptions, unsafeDisableValidation = false
340
341
  ],
341
342
  treeShake: false
342
343
  }));
344
+ const transformedData = transformer ? await applyInputTransformer(dereferencedData, transformer, workspace) : dereferencedData;
343
345
  if (unsafeDisableValidation) logWarning("🚨 OpenAPI spec validation is disabled.\n Code generation with invalid specs is not guaranteed to work and may break in minor updates.\n Bug reports with validation disabled will not be accepted.");
344
346
  else {
345
- validateComponentKeys(dereferencedData);
346
- const { valid, errors } = await validate(dereferencedData);
347
+ validateComponentKeys(transformedData);
348
+ const { valid, errors } = await validate(transformedData);
347
349
  if (!valid) throw new Error(`OpenAPI spec validation failed:\n${JSON.stringify(errors, void 0, 2)}`);
348
350
  }
349
- const { specification } = upgrade(dereferencedData);
351
+ const { specification } = upgrade(transformedData);
350
352
  return specification;
351
353
  }
354
+ async function applyInputTransformer(data, transformer, workspace) {
355
+ const transformerFn = await dynamicImport(transformer, workspace);
356
+ const result = await transformerFn(data);
357
+ if (!isObject(result)) {
358
+ const source = isString(transformer) ? transformer : transformerFn.name || "<inline function>";
359
+ throw new Error(`input.override.transformer must return an OpenAPI document object; got ${result === void 0 ? "undefined" : typeof result} from ${source}. Ensure your transformer returns the (possibly modified) spec.`);
360
+ }
361
+ return result;
362
+ }
352
363
  async function importSpecs(workspace, options, projectName) {
353
364
  const { input, output } = options;
354
365
  return importOpenApi({
355
- spec: await resolveSpec(input.target, input.parserOptions, input.unsafeDisableValidation),
366
+ spec: await resolveSpec(input.target, {
367
+ parserOptions: input.parserOptions,
368
+ transformer: input.override.transformer,
369
+ workspace,
370
+ unsafeDisableValidation: input.unsafeDisableValidation
371
+ }),
356
372
  input,
357
373
  output,
358
374
  target: isString(input.target) ? input.target : workspace,
@@ -480,6 +496,23 @@ function updateInternalRefs(obj, extKey, schemaNameMappings) {
480
496
  return obj;
481
497
  }
482
498
  /**
499
+ * Decode a single JSON Pointer reference token taken from an x-ext `$ref`.
500
+ *
501
+ * The token carries two layers of encoding: it sits in a URI fragment, so it
502
+ * may be percent-encoded (e.g. `%7B` for `{` in templated paths), and it is a
503
+ * JSON Pointer token, so `~1`/`~0` stand for `/`/`~` (RFC 6901). Percent-
504
+ * encoding is the outer layer and is removed first; a malformed sequence is
505
+ * left as-is rather than throwing. Without this, tokens such as `~1pets`
506
+ * never match the real `/pets` key and the external `$ref` fails to resolve.
507
+ */
508
+ function decodeRefToken(token) {
509
+ let decoded = token;
510
+ try {
511
+ decoded = decodeURIComponent(token);
512
+ } catch {}
513
+ return decoded.replaceAll("~1", "/").replaceAll("~0", "~");
514
+ }
515
+ /**
483
516
  * Replace x-ext refs with standard component refs, or inline the content.
484
517
  * `inliningRefs` tracks the inline chain to break cycles in recursive
485
518
  * external schemas that aren't under `components.schemas` (#1642).
@@ -504,10 +537,13 @@ function replaceXExtRefs(obj, extensions, schemaNameMappings, inliningRefs = /*
504
537
  return {};
505
538
  }
506
539
  let refObj = extensions[extKey];
507
- for (const p of parts) if (refObj && (isObject(refObj) || Array.isArray(refObj)) && p in refObj) refObj = refObj[p];
508
- else {
509
- refObj = void 0;
510
- break;
540
+ for (const rawPart of parts) {
541
+ const p = decodeRefToken(rawPart);
542
+ if (refObj && (isObject(refObj) || Array.isArray(refObj)) && p in refObj) refObj = refObj[p];
543
+ else {
544
+ refObj = void 0;
545
+ break;
546
+ }
511
547
  }
512
548
  if (refObj) {
513
549
  const cleaned = scrubUnwantedKeys(refObj);
@@ -825,15 +861,35 @@ async function normalizeOptions(optionsExport, workspace = process.cwd(), global
825
861
  const { clean, client, httpClient, mode } = globalOptions;
826
862
  const tsconfig = await loadTsconfig(outputOptions.tsconfig ?? globalOptions.tsconfig, workspace);
827
863
  const packageJson = await loadPackageJson(outputOptions.packageJson ?? globalOptions.packageJson, workspace);
828
- const mockOption = outputOptions.mock ?? globalOptions.mock;
829
- let mock;
830
- if (isBoolean(mockOption) && mockOption) mock = DEFAULT_MOCK_OPTIONS;
831
- else if (isFunction(mockOption)) mock = mockOption;
832
- else if (mockOption) mock = {
833
- ...DEFAULT_MOCK_OPTIONS,
834
- ...mockOption
864
+ const mocksOption = outputOptions.mock ?? globalOptions.mock;
865
+ let mocks = {
866
+ indexMockFiles: false,
867
+ generators: []
868
+ };
869
+ if (isBoolean(mocksOption) && mocksOption) mocks = {
870
+ indexMockFiles: false,
871
+ generators: [getDefaultMockOptionsForType(OutputMockType.MSW), getDefaultMockOptionsForType(OutputMockType.FAKER)]
872
+ };
873
+ else if (isFunction(mocksOption)) mocks = {
874
+ indexMockFiles: false,
875
+ generators: [mocksOption]
835
876
  };
836
- else mock = void 0;
877
+ else if (mocksOption && typeof mocksOption === "object") {
878
+ if (!Array.isArray(mocksOption.generators)) throw new TypeError("mock.generators must be an array of generator entries (e.g. [{ type: \"msw\" }]).");
879
+ mocks = {
880
+ indexMockFiles: mocksOption.indexMockFiles ?? false,
881
+ generators: mocksOption.generators.map((m) => isFunction(m) ? m : {
882
+ ...getDefaultMockOptionsForType(m.type),
883
+ ...m
884
+ })
885
+ };
886
+ }
887
+ const seenMockTypes = /* @__PURE__ */ new Set();
888
+ for (const entry of mocks.generators) {
889
+ if (isFunction(entry)) continue;
890
+ if (seenMockTypes.has(entry.type)) throw new Error(`Duplicate mock generator type "${entry.type}". Each type can only appear once in mock.generators.`);
891
+ seenMockTypes.add(entry.type);
892
+ }
837
893
  const defaultFileExtension = ".ts";
838
894
  const globalQueryOptions = {
839
895
  signal: true,
@@ -861,7 +917,7 @@ async function normalizeOptions(optionsExport, workspace = process.cwd(), global
861
917
  client: outputOptions.client ?? client ?? OutputClient.AXIOS_FUNCTIONS,
862
918
  httpClient: outputOptions.httpClient ?? httpClient ?? ((outputOptions.client ?? client) === OutputClient.ANGULAR_QUERY ? OutputHttpClient.ANGULAR : OutputHttpClient.FETCH),
863
919
  mode: normalizeOutputMode(outputOptions.mode ?? mode),
864
- mock,
920
+ mock: mocks,
865
921
  clean: outputOptions.clean ?? clean ?? false,
866
922
  docs: outputOptions.docs ?? false,
867
923
  formatter: outputOptions.formatter ?? globalOptions.formatter,
@@ -887,6 +943,7 @@ async function normalizeOptions(optionsExport, workspace = process.cwd(), global
887
943
  formData: createFormData(outputWorkspace, outputOptions.override?.formData),
888
944
  formUrlEncoded: (isBoolean(outputOptions.override?.formUrlEncoded) ? outputOptions.override.formUrlEncoded : normalizeMutator(outputWorkspace, outputOptions.override?.formUrlEncoded)) ?? true,
889
945
  paramsSerializer: normalizeMutator(outputWorkspace, outputOptions.override?.paramsSerializer),
946
+ paramsFilter: normalizeMutator(outputWorkspace, outputOptions.override?.paramsFilter),
890
947
  header: outputOptions.override?.header === false ? false : isFunction(outputOptions.override?.header) ? outputOptions.override.header : getDefaultFilesHeader,
891
948
  requestOptions: outputOptions.override?.requestOptions ?? true,
892
949
  namingConvention: outputOptions.override?.namingConvention ?? {},
@@ -982,6 +1039,14 @@ async function normalizeOptions(optionsExport, workspace = process.cwd(), global
982
1039
  };
983
1040
  if (!normalizedOptions.input.target) throw new Error(styleText("red", `Config requires an input target.`));
984
1041
  if (!normalizedOptions.output.target && !normalizedOptions.output.schemas) throw new Error(styleText("red", `Config requires an output target or schemas.`));
1042
+ const usesAngularGenerator = normalizedOptions.output.client === OutputClient.ANGULAR || normalizedOptions.output.client === OutputClient.ANGULAR_QUERY && normalizedOptions.output.httpClient === OutputHttpClient.ANGULAR;
1043
+ if (normalizedOptions.output.override.paramsFilter && !usesAngularGenerator) throw new Error(styleText("red", `\`override.paramsFilter\` is only supported by the Angular generator (the \`angular\` client, or \`angular-query\` with \`httpClient: 'angular'\`). It has no effect for other clients — use \`override.paramsSerializer\` instead.`));
1044
+ if (!usesAngularGenerator) {
1045
+ const offendingOperation = Object.entries(normalizedOptions.output.override.operations).find(([, opOverride]) => opOverride?.paramsFilter)?.[0];
1046
+ if (offendingOperation) throw new Error(styleText("red", `\`override.operations["${offendingOperation}"].paramsFilter\` is only supported by the Angular generator (the \`angular\` client, or \`angular-query\` with \`httpClient: 'angular'\`). It has no effect for other clients — use \`override.paramsSerializer\` instead.`));
1047
+ const offendingTag = Object.entries(normalizedOptions.output.override.tags).find(([, tagOverride]) => tagOverride?.paramsFilter)?.[0];
1048
+ if (offendingTag) throw new Error(styleText("red", `\`override.tags["${offendingTag}"].paramsFilter\` is only supported by the Angular generator (the \`angular\` client, or \`angular-query\` with \`httpClient: 'angular'\`). It has no effect for other clients — use \`override.paramsSerializer\` instead.`));
1049
+ }
985
1050
  if (normalizedOptions.output.httpClient === OutputHttpClient.FETCH && normalizedOptions.output.optionsParamRequired && normalizedOptions.output.override.requestOptions !== false) logWarning(`⚠️ With \`httpClient: 'fetch'\`, \`optionsParamRequired: true\` cannot make the generated \`options\` parameter required. The fetch \`options\` parameter remains optional with type \`RequestInit\` (\`optionsParamRequired\` may still affect other generated parameters). Set \`httpClient: 'axios'\` to make the \`options\` parameter required.`);
986
1051
  return normalizedOptions;
987
1052
  }
@@ -1064,7 +1129,7 @@ function normalizePath(path$1, workspace) {
1064
1129
  return path.resolve(workspace, path$1);
1065
1130
  }
1066
1131
  function normalizeOperationsAndTags(operationsOrTags, workspace, global) {
1067
- return Object.fromEntries(Object.entries(operationsOrTags).map(([key, { transformer, mutator, formData, formUrlEncoded, paramsSerializer, query, angular, zod, ...rest }]) => {
1132
+ return Object.fromEntries(Object.entries(operationsOrTags).map(([key, { transformer, mutator, formData, formUrlEncoded, paramsSerializer, paramsFilter, query, angular, zod, ...rest }]) => {
1068
1133
  return [key, {
1069
1134
  ...rest,
1070
1135
  ...angular ? { angular: {
@@ -1112,7 +1177,8 @@ function normalizeOperationsAndTags(operationsOrTags, workspace, global) {
1112
1177
  ...mutator ? { mutator: normalizeMutator(workspace, mutator) } : {},
1113
1178
  ...formData === void 0 ? {} : { formData: createFormData(workspace, formData) },
1114
1179
  ...formUrlEncoded ? { formUrlEncoded: isBoolean(formUrlEncoded) ? formUrlEncoded : normalizeMutator(workspace, formUrlEncoded) } : {},
1115
- ...paramsSerializer ? { paramsSerializer: normalizeMutator(workspace, paramsSerializer) } : {}
1180
+ ...paramsSerializer ? { paramsSerializer: normalizeMutator(workspace, paramsSerializer) } : {},
1181
+ ...paramsFilter ? { paramsFilter: normalizeMutator(workspace, paramsFilter) } : {}
1116
1182
  }];
1117
1183
  }));
1118
1184
  }
@@ -1361,6 +1427,10 @@ async function writeZodSchemasFromVerbs(verbOptions, schemasPath, fileExtension,
1361
1427
  const coerce = output.override.zod.coerce.body;
1362
1428
  const uniqueVerbsSchemas = dedupeSchemasByName(verbOptionsArray.flatMap((verbOption) => {
1363
1429
  const operation = verbOption.originalOperation;
1430
+ const shouldGenerate = {
1431
+ ...output.override.zod.generate,
1432
+ ...verbOption.override?.zod.generate
1433
+ };
1364
1434
  const requestBody = operation.requestBody;
1365
1435
  const requestBodyContent = requestBody && "content" in requestBody ? requestBody.content : void 0;
1366
1436
  const jsonBodyMedia = requestBodyContent?.["application/json"];
@@ -1368,7 +1438,7 @@ async function writeZodSchemasFromVerbs(verbOptions, schemasPath, fileExtension,
1368
1438
  const formUrlEncodedBodyMedia = requestBodyContent?.["application/x-www-form-urlencoded"];
1369
1439
  const [bodyContentType, bodyMedia] = jsonBodyMedia ? ["application/json", jsonBodyMedia] : formDataBodyMedia ? ["multipart/form-data", formDataBodyMedia] : formUrlEncodedBodyMedia ? ["application/x-www-form-urlencoded", formUrlEncodedBodyMedia] : [void 0, void 0];
1370
1440
  const bodySchema = bodyMedia?.schema;
1371
- const bodySchemas = bodySchema ? [{
1441
+ const bodySchemas = shouldGenerate.body && bodySchema ? [{
1372
1442
  name: `${pascal(verbOption.operationName)}Body`,
1373
1443
  schema: dereference(bodySchema, zodContext),
1374
1444
  bodyContentType,
@@ -1376,7 +1446,7 @@ async function writeZodSchemasFromVerbs(verbOptions, schemasPath, fileExtension,
1376
1446
  }] : [];
1377
1447
  const parameters = operation.parameters;
1378
1448
  const queryParams = parameters?.filter((p) => "in" in p && p.in === "query");
1379
- const queryParamsSchemas = queryParams && queryParams.length > 0 ? [{
1449
+ const queryParamsSchemas = shouldGenerate.query && queryParams && queryParams.length > 0 ? [{
1380
1450
  name: `${pascal(verbOption.operationName)}Params`,
1381
1451
  schema: {
1382
1452
  type: "object",
@@ -1385,7 +1455,7 @@ async function writeZodSchemasFromVerbs(verbOptions, schemasPath, fileExtension,
1385
1455
  }
1386
1456
  }] : [];
1387
1457
  const headerParams = parameters?.filter((p) => "in" in p && p.in === "header");
1388
- const headerParamsSchemas = headerParams && headerParams.length > 0 ? [{
1458
+ const headerParamsSchemas = shouldGenerate.header && headerParams && headerParams.length > 0 ? [{
1389
1459
  name: `${pascal(verbOption.operationName)}Headers`,
1390
1460
  schema: {
1391
1461
  type: "object",
@@ -1393,10 +1463,10 @@ async function writeZodSchemasFromVerbs(verbOptions, schemasPath, fileExtension,
1393
1463
  required: headerParams.filter((p) => p.required).map((p) => p.name).filter((name) => name !== void 0)
1394
1464
  }
1395
1465
  }] : [];
1396
- const responseSchemas = [...verbOption.response.types.success, ...verbOption.response.types.errors].filter((responseType) => !!responseType.originalSchema && !responseType.isRef && isValidSchemaIdentifier(responseType.value) && !isPrimitiveSchemaName(responseType.value)).map((responseType) => ({
1466
+ const responseSchemas = shouldGenerate.response ? [...verbOption.response.types.success, ...verbOption.response.types.errors].filter((responseType) => !!responseType.originalSchema && !responseType.isRef && isValidSchemaIdentifier(responseType.value) && !isPrimitiveSchemaName(responseType.value)).map((responseType) => ({
1397
1467
  name: responseType.value,
1398
1468
  schema: dereference(responseType.originalSchema, zodContext)
1399
- }));
1469
+ })) : [];
1400
1470
  return dedupeSchemasByName([
1401
1471
  ...bodySchemas,
1402
1472
  ...queryParamsSchemas,
@@ -1487,8 +1557,8 @@ async function writeSpecs(builder, workspace, options, projectName) {
1487
1557
  const { regularSchemas, operationSchemas: opSchemas } = splitSchemasByType(schemas);
1488
1558
  const regularSchemaNames = new Set(regularSchemas.map((s) => s.name));
1489
1559
  const operationSchemaNames = new Set(opSchemas.map((s) => s.name));
1490
- fixCrossDirectoryImports(opSchemas, regularSchemaNames, schemaPath, output.operationSchemas, output.namingConvention, fileExtension);
1491
- fixRegularSchemaImports(regularSchemas, operationSchemaNames, schemaPath, output.operationSchemas, output.namingConvention, fileExtension);
1560
+ fixCrossDirectoryImports(opSchemas, regularSchemaNames, schemaPath, output.operationSchemas, output.namingConvention, fileExtension, output.tsconfig);
1561
+ fixRegularSchemaImports(regularSchemas, operationSchemaNames, schemaPath, output.operationSchemas, output.namingConvention, fileExtension, output.tsconfig);
1492
1562
  if (regularSchemas.length > 0) await writeSchemas({
1493
1563
  schemaPath,
1494
1564
  schemas: regularSchemas,
@@ -1496,7 +1566,8 @@ async function writeSpecs(builder, workspace, options, projectName) {
1496
1566
  namingConvention: output.namingConvention,
1497
1567
  fileExtension,
1498
1568
  header,
1499
- indexFiles: output.indexFiles
1569
+ indexFiles: output.indexFiles,
1570
+ tsconfig: output.tsconfig
1500
1571
  });
1501
1572
  if (opSchemas.length > 0) {
1502
1573
  await writeSchemas({
@@ -1506,7 +1577,8 @@ async function writeSpecs(builder, workspace, options, projectName) {
1506
1577
  namingConvention: output.namingConvention,
1507
1578
  fileExtension,
1508
1579
  header,
1509
- indexFiles: output.indexFiles
1580
+ indexFiles: output.indexFiles,
1581
+ tsconfig: output.tsconfig
1510
1582
  });
1511
1583
  if (output.indexFiles) await addOperationSchemasReExport(schemaPath, output.operationSchemas, header);
1512
1584
  }
@@ -1517,7 +1589,8 @@ async function writeSpecs(builder, workspace, options, projectName) {
1517
1589
  namingConvention: output.namingConvention,
1518
1590
  fileExtension,
1519
1591
  header,
1520
- indexFiles: output.indexFiles
1592
+ indexFiles: output.indexFiles,
1593
+ tsconfig: output.tsconfig
1521
1594
  });
1522
1595
  } else if (output.schemas.type === "typescript") {
1523
1596
  const fileExtension = output.fileExtension || ".ts";
@@ -1525,8 +1598,8 @@ async function writeSpecs(builder, workspace, options, projectName) {
1525
1598
  const { regularSchemas, operationSchemas: opSchemas } = splitSchemasByType(schemas);
1526
1599
  const regularSchemaNames = new Set(regularSchemas.map((s) => s.name));
1527
1600
  const operationSchemaNames = new Set(opSchemas.map((s) => s.name));
1528
- fixCrossDirectoryImports(opSchemas, regularSchemaNames, output.schemas.path, output.operationSchemas, output.namingConvention, fileExtension);
1529
- fixRegularSchemaImports(regularSchemas, operationSchemaNames, output.schemas.path, output.operationSchemas, output.namingConvention, fileExtension);
1601
+ fixCrossDirectoryImports(opSchemas, regularSchemaNames, output.schemas.path, output.operationSchemas, output.namingConvention, fileExtension, output.tsconfig);
1602
+ fixRegularSchemaImports(regularSchemas, operationSchemaNames, output.schemas.path, output.operationSchemas, output.namingConvention, fileExtension, output.tsconfig);
1530
1603
  if (regularSchemas.length > 0) await writeSchemas({
1531
1604
  schemaPath: output.schemas.path,
1532
1605
  schemas: regularSchemas,
@@ -1534,7 +1607,8 @@ async function writeSpecs(builder, workspace, options, projectName) {
1534
1607
  namingConvention: output.namingConvention,
1535
1608
  fileExtension,
1536
1609
  header,
1537
- indexFiles: output.indexFiles
1610
+ indexFiles: output.indexFiles,
1611
+ tsconfig: output.tsconfig
1538
1612
  });
1539
1613
  if (opSchemas.length > 0) {
1540
1614
  await writeSchemas({
@@ -1544,7 +1618,8 @@ async function writeSpecs(builder, workspace, options, projectName) {
1544
1618
  namingConvention: output.namingConvention,
1545
1619
  fileExtension,
1546
1620
  header,
1547
- indexFiles: output.indexFiles
1621
+ indexFiles: output.indexFiles,
1622
+ tsconfig: output.tsconfig
1548
1623
  });
1549
1624
  if (output.indexFiles) await addOperationSchemasReExport(output.schemas.path, output.operationSchemas, header);
1550
1625
  }
@@ -1555,7 +1630,8 @@ async function writeSpecs(builder, workspace, options, projectName) {
1555
1630
  namingConvention: output.namingConvention,
1556
1631
  fileExtension,
1557
1632
  header,
1558
- indexFiles: output.indexFiles
1633
+ indexFiles: output.indexFiles,
1634
+ tsconfig: output.tsconfig
1559
1635
  });
1560
1636
  } else {
1561
1637
  const fileExtension = ".zod.ts";
@@ -1586,7 +1662,8 @@ async function writeSpecs(builder, workspace, options, projectName) {
1586
1662
  if (output.workspace) {
1587
1663
  const workspacePath = output.workspace;
1588
1664
  const indexFile = path.join(workspacePath, "index.ts");
1589
- const imports = implementationPaths.filter((p) => !output.mock || !p.endsWith(`.${getMockFileExtensionByTypeName(output.mock)}.ts`)).map((p) => upath.getRelativeImportPath(indexFile, getFileInfo(p).pathWithoutExtension, true));
1665
+ const mockExtensions = output.mock.generators.map((g) => getMockFileExtensionByTypeName(g));
1666
+ const imports = implementationPaths.filter((p) => mockExtensions.length === 0 || !mockExtensions.some((ext) => p.endsWith(`.${ext}.ts`))).map((p) => upath.getRelativeImportPath(indexFile, getFileInfo(p).pathWithoutExtension, true));
1590
1667
  if (output.schemas) {
1591
1668
  const schemasPath = isString(output.schemas) ? output.schemas : output.schemas.path;
1592
1669
  imports.push(upath.getRelativeImportPath(indexFile, getFileInfo(schemasPath).dirname));
@@ -1626,6 +1703,7 @@ async function writeSpecs(builder, workspace, options, projectName) {
1626
1703
  const app = await (await getTypedocApplication()).bootstrapWithPlugins({
1627
1704
  entryPoints: paths.map((x) => upath.toUnix(x)),
1628
1705
  theme: "markdown",
1706
+ skipErrorChecking: true,
1629
1707
  ...config,
1630
1708
  plugin: ["typedoc-plugin-markdown", ...config.plugin ?? []]
1631
1709
  });
@@ -1736,4 +1814,4 @@ async function loadConfigFile(configFilePath) {
1736
1814
  //#endregion
1737
1815
  export { defineConfig as a, description as c, startWatcher as i, name as l, loadConfigFile as n, defineTransformer as o, generateSpec as r, normalizeOptions as s, findConfigFile as t, version as u };
1738
1816
 
1739
- //# sourceMappingURL=config-Cuc_7Hju.mjs.map
1817
+ //# sourceMappingURL=config-C7iZzhig.mjs.map