@orval/core 7.3.0 → 7.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/dist/index.d.ts CHANGED
@@ -3,7 +3,9 @@ import { allLocales } from '@faker-js/faker';
3
3
  import * as openapi3_ts_oas30 from 'openapi3-ts/oas30';
4
4
  import { InfoObject, OperationObject, OpenAPIObject, ResponsesObject, ReferenceObject, RequestBodyObject, ParameterObject, SchemaObject, ComponentsObject, SchemasObject, PathItemObject, ResponseObject, ExampleObject } from 'openapi3-ts/oas30';
5
5
  import swagger2openapi from 'swagger2openapi';
6
+ import { TypeDocOptions } from 'typedoc';
6
7
  import { ValueIteratee } from 'lodash';
8
+ import { ServerObject } from 'openapi3-ts/oas31';
7
9
  import { CompareOperator } from 'compare-versions';
8
10
  import debug from 'debug';
9
11
 
@@ -38,6 +40,7 @@ type NormalizedOutputOptions = {
38
40
  client: OutputClient | OutputClientFunc;
39
41
  httpClient: OutputHttpClient;
40
42
  clean: boolean | string[];
43
+ docs: boolean | OutputDocsOptions;
41
44
  prettier: boolean;
42
45
  tslint: boolean;
43
46
  biome: boolean;
@@ -45,11 +48,12 @@ type NormalizedOutputOptions = {
45
48
  packageJson?: PackageJson;
46
49
  headers: boolean;
47
50
  indexFiles: boolean;
48
- baseUrl?: string;
51
+ baseUrl?: string | BaseUrlFromSpec | BaseUrlFromConstant;
49
52
  allParamsOptional: boolean;
50
53
  urlEncodeParameters: boolean;
51
54
  unionAddMissingProperties: boolean;
52
55
  optionsParamRequired: boolean;
56
+ propertySortOrder: PropertySortOrder;
53
57
  };
54
58
  type NormalizedParamsSerializerOptions = {
55
59
  qs?: Record<string, any>;
@@ -137,6 +141,25 @@ type NormalizedInputOptions = {
137
141
  filters?: InputFiltersOption;
138
142
  };
139
143
  type OutputClientFunc = (clients: GeneratorClients) => ClientGeneratorsBuilder;
144
+ type BaseUrlFromSpec = {
145
+ getBaseUrlFromSpecification: true;
146
+ variables?: {
147
+ [variable: string]: string;
148
+ };
149
+ index?: number;
150
+ baseUrl?: never;
151
+ };
152
+ type BaseUrlFromConstant = {
153
+ getBaseUrlFromSpecification: false;
154
+ variables?: never;
155
+ index?: never;
156
+ baseUrl: string;
157
+ };
158
+ declare const PropertySortOrder: {
159
+ readonly ALPHABETICAL: "Alphabetical";
160
+ readonly SPECIFICATION: "Specification";
161
+ };
162
+ type PropertySortOrder = (typeof PropertySortOrder)[keyof typeof PropertySortOrder];
140
163
  type OutputOptions = {
141
164
  workspace?: string;
142
165
  target?: string;
@@ -148,6 +171,7 @@ type OutputOptions = {
148
171
  client?: OutputClient | OutputClientFunc;
149
172
  httpClient?: OutputHttpClient;
150
173
  clean?: boolean | string[];
174
+ docs?: boolean | OutputDocsOptions;
151
175
  prettier?: boolean;
152
176
  tslint?: boolean;
153
177
  biome?: boolean;
@@ -155,11 +179,12 @@ type OutputOptions = {
155
179
  packageJson?: string;
156
180
  headers?: boolean;
157
181
  indexFiles?: boolean;
158
- baseUrl?: string;
182
+ baseUrl?: string | BaseUrlFromSpec | BaseUrlFromConstant;
159
183
  allParamsOptional?: boolean;
160
184
  urlEncodeParameters?: boolean;
161
185
  unionAddMissingProperties?: boolean;
162
186
  optionsParamRequired?: boolean;
187
+ propertySortOrder?: PropertySortOrder;
163
188
  };
164
189
  type SwaggerParserOptions = Omit<SwaggerParser.Options, 'validate'> & {
165
190
  validate?: boolean;
@@ -202,6 +227,9 @@ declare const OutputMode: {
202
227
  readonly TAGS_SPLIT: "tags-split";
203
228
  };
204
229
  type OutputMode = (typeof OutputMode)[keyof typeof OutputMode];
230
+ type OutputDocsOptions = {
231
+ configPath?: string;
232
+ } & Partial<TypeDocOptions>;
205
233
  declare const OutputMockType: {
206
234
  readonly MSW: "msw";
207
235
  };
@@ -1137,6 +1165,7 @@ declare const getResponse: ({ responses, operationName, context, contentType, }:
1137
1165
  }) => GetterResponse;
1138
1166
 
1139
1167
  declare const getRoute: (route: string) => string;
1168
+ declare const getFullRoute: (route: string, servers: ServerObject[] | undefined, baseUrl: string | BaseUrlFromConstant | BaseUrlFromSpec | undefined) => string;
1140
1169
  declare const getRouteAsArray: (route: string) => string;
1141
1170
 
1142
1171
  /**
@@ -1305,12 +1334,12 @@ declare const count: (str: string | undefined, key: string) => number;
1305
1334
 
1306
1335
  declare const openApiConverter: (schema: any, options: swagger2openapi.Options | undefined, specKey: string) => Promise<OpenAPIObject>;
1307
1336
 
1308
- declare let join: (...paths: string[]) => string;
1309
- declare let resolve: (...paths: string[]) => string;
1310
- declare let extname: (path: string) => string;
1311
- declare let dirname: (path: string) => string;
1312
- declare let basename: (path: string, suffix?: string | undefined) => string;
1313
- declare let isAbsolute: (path: string) => boolean;
1337
+ declare const join: (...paths: string[]) => string;
1338
+ declare const resolve: (...paths: string[]) => string;
1339
+ declare const extname: (path: string) => string;
1340
+ declare const dirname: (path: string) => string;
1341
+ declare const basename: (path: string, suffix?: string | undefined) => string;
1342
+ declare const isAbsolute: (path: string) => boolean;
1314
1343
 
1315
1344
  /**
1316
1345
  * Behaves exactly like `path.relative(from, to)`, but keeps the first meaningful "./"
@@ -1421,4 +1450,4 @@ declare const generateTarget: (builder: WriteSpecsBuilder, options: NormalizedOu
1421
1450
 
1422
1451
  declare const generateTargetForTags: (builder: WriteSpecsBuilder, options: NormalizedOutputOptions) => Record<string, GeneratorTarget>;
1423
1452
 
1424
- export { type AngularOptions, BODY_TYPE_NAME, type ClientBuilder, type ClientDependenciesBuilder, type ClientExtraFilesBuilder, type ClientFileBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientMockGeneratorBuilder, type ClientMockGeneratorImplementation, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, type FetchOptions, type GenerateMockImports, type GeneratorApiBuilder, type GeneratorApiOperations, type GeneratorApiResponse, type GeneratorClient, type GeneratorClientExtra, type GeneratorClientFooter, type GeneratorClientHeader, type GeneratorClientImports, type GeneratorClientTitle, type GeneratorClients, type GeneratorDependency, type GeneratorImport, type GeneratorMutator, type GeneratorMutatorParsingInfo, type GeneratorOperation, type GeneratorOperations, type GeneratorOptions, type GeneratorSchema, type GeneratorTarget, type GeneratorTargetFull, type GeneratorVerbOptions, type GeneratorVerbsOptions, type GetterBody, type GetterParam, type GetterParameters, type GetterParams, type GetterProp, GetterPropType, type GetterProps, type GetterQueryParam, type GetterResponse, type GlobalMockOptions, type GlobalOptions, type HonoOptions, type Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputFiltersOption, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockData, type MockDataArray, type MockDataArrayFn, type MockDataObject, type MockDataObjectFn, type MockOptions, type MockProperties, type MockPropertiesObject, type MockPropertiesObjectFn, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHonoOptions, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type NormalizedZodOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, OutputHttpClient, OutputMockType, OutputMode, type OutputOptions, type OverrideInput, type OverrideMockOptions, type OverrideOutput, type OverrideOutputContentType, type PackageJson, type ParamsSerializerOptions, type QueryOptions, RefComponentSuffix, type RefInfo, type ResReqTypesValue, type ResolverValue, type ScalarValue, SchemaType, type SchemaWithConst, type SwaggerParserOptions, type SwrOptions, TEMPLATE_TAG_REGEX, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, type ZodCoerceType, type ZodOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, escape, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbsOptions, getArray, getBody, getEnum, getEnumImplementation, getExtension, getFileInfo, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getRoute, getRouteAsArray, getScalar, ibmOpenapiValidator, ibmOpenapiValidatorErrors, ibmOpenapiValidatorWarnings, isBoolean, isDirectory, isFunction, isModule, isNull, isNumber, isNumeric, isObject, isReference, isRootKey, isSchema, isString, isSyntheticDefaultImportsAllow, isUndefined, isUrl, isVerb, jsDoc, jsStringEscape, kebab, loadFile, log, logError, mergeDeep, mismatchArgsMessage, openApiConverter, pascal, removeFiles, resolveDiscriminators, resolveExampleRefs, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, startMessage, stringify, toObjectString, path as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
1453
+ export { type AngularOptions, BODY_TYPE_NAME, type BaseUrlFromConstant, type BaseUrlFromSpec, type ClientBuilder, type ClientDependenciesBuilder, type ClientExtraFilesBuilder, type ClientFileBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientMockGeneratorBuilder, type ClientMockGeneratorImplementation, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, type FetchOptions, type GenerateMockImports, type GeneratorApiBuilder, type GeneratorApiOperations, type GeneratorApiResponse, type GeneratorClient, type GeneratorClientExtra, type GeneratorClientFooter, type GeneratorClientHeader, type GeneratorClientImports, type GeneratorClientTitle, type GeneratorClients, type GeneratorDependency, type GeneratorImport, type GeneratorMutator, type GeneratorMutatorParsingInfo, type GeneratorOperation, type GeneratorOperations, type GeneratorOptions, type GeneratorSchema, type GeneratorTarget, type GeneratorTargetFull, type GeneratorVerbOptions, type GeneratorVerbsOptions, type GetterBody, type GetterParam, type GetterParameters, type GetterParams, type GetterProp, GetterPropType, type GetterProps, type GetterQueryParam, type GetterResponse, type GlobalMockOptions, type GlobalOptions, type HonoOptions, type Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputFiltersOption, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockData, type MockDataArray, type MockDataArrayFn, type MockDataObject, type MockDataObjectFn, type MockOptions, type MockProperties, type MockPropertiesObject, type MockPropertiesObjectFn, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHonoOptions, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type NormalizedZodOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, type OutputDocsOptions, OutputHttpClient, OutputMockType, OutputMode, type OutputOptions, type OverrideInput, type OverrideMockOptions, type OverrideOutput, type OverrideOutputContentType, type PackageJson, type ParamsSerializerOptions, PropertySortOrder, type QueryOptions, RefComponentSuffix, type RefInfo, type ResReqTypesValue, type ResolverValue, type ScalarValue, SchemaType, type SchemaWithConst, type SwaggerParserOptions, type SwrOptions, TEMPLATE_TAG_REGEX, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, type ZodCoerceType, type ZodOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, escape, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbsOptions, getArray, getBody, getEnum, getEnumImplementation, getExtension, getFileInfo, getFullRoute, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getRoute, getRouteAsArray, getScalar, ibmOpenapiValidator, ibmOpenapiValidatorErrors, ibmOpenapiValidatorWarnings, isBoolean, isDirectory, isFunction, isModule, isNull, isNumber, isNumeric, isObject, isReference, isRootKey, isSchema, isString, isSyntheticDefaultImportsAllow, isUndefined, isUrl, isVerb, jsDoc, jsStringEscape, kebab, loadFile, log, logError, mergeDeep, mismatchArgsMessage, openApiConverter, pascal, removeFiles, resolveDiscriminators, resolveExampleRefs, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, startMessage, stringify, toObjectString, path as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
package/dist/index.js CHANGED
@@ -48092,6 +48092,7 @@ __export(src_exports, {
48092
48092
  OutputHttpClient: () => OutputHttpClient,
48093
48093
  OutputMockType: () => OutputMockType,
48094
48094
  OutputMode: () => OutputMode,
48095
+ PropertySortOrder: () => PropertySortOrder,
48095
48096
  RefComponentSuffix: () => RefComponentSuffix,
48096
48097
  SchemaType: () => SchemaType,
48097
48098
  TEMPLATE_TAG_REGEX: () => TEMPLATE_TAG_REGEX,
@@ -48139,6 +48140,7 @@ __export(src_exports, {
48139
48140
  getEnumImplementation: () => getEnumImplementation,
48140
48141
  getExtension: () => getExtension,
48141
48142
  getFileInfo: () => getFileInfo,
48143
+ getFullRoute: () => getFullRoute,
48142
48144
  getIsBodyVerb: () => getIsBodyVerb,
48143
48145
  getKey: () => getKey,
48144
48146
  getMockFileExtensionByTypeName: () => getMockFileExtensionByTypeName,
@@ -48212,6 +48214,10 @@ __export(src_exports, {
48212
48214
  module.exports = __toCommonJS(src_exports);
48213
48215
 
48214
48216
  // src/types.ts
48217
+ var PropertySortOrder = {
48218
+ ALPHABETICAL: "Alphabetical",
48219
+ SPECIFICATION: "Specification"
48220
+ };
48215
48221
  var OutputClient = {
48216
48222
  ANGULAR: "angular",
48217
48223
  AXIOS: "axios",
@@ -48849,7 +48855,7 @@ function isUndefined(x3) {
48849
48855
  return typeof x3 === "undefined";
48850
48856
  }
48851
48857
  function isNull(x3) {
48852
- return typeof x3 === null;
48858
+ return x3 === null;
48853
48859
  }
48854
48860
  function isSchema(x3) {
48855
48861
  if (!isObject(x3)) {
@@ -49665,7 +49671,7 @@ var resolveObjectOriginal = ({
49665
49671
  context.output.override.useNativeEnums
49666
49672
  );
49667
49673
  return {
49668
- value: propName,
49674
+ value: context.output.override.useNativeEnums ? `keyof typeof ${propName}` : propName,
49669
49675
  imports: [{ name: propName }],
49670
49676
  schemas: [
49671
49677
  ...resolvedValue.schemas,
@@ -49765,6 +49771,16 @@ var getArray = ({
49765
49771
  example: schema.example,
49766
49772
  examples: resolveExampleRefs(schema.examples, context)
49767
49773
  };
49774
+ } else if (compareVersions(context.specs[context.specKey].openapi, "3.1", ">=")) {
49775
+ return {
49776
+ value: "unknown[]",
49777
+ imports: [],
49778
+ schemas: [],
49779
+ isEnum: false,
49780
+ type: "array",
49781
+ isRef: false,
49782
+ hasReadonlyProps: false
49783
+ };
49768
49784
  } else {
49769
49785
  throw new Error(
49770
49786
  `All arrays must have an \`items\` key defined (name=${name}, schema=${JSON.stringify(schema)})`
@@ -49978,9 +49994,9 @@ var getSchemaFormDataAndUrlEncoded = ({
49978
49994
  let form = isUrlEncoded ? `const ${variableName} = new URLSearchParams();
49979
49995
  ` : `const ${variableName} = new FormData();
49980
49996
  `;
49981
- if (schema.type === "object") {
49982
- if (schema.oneOf || schema.anyOf || schema.allOf) {
49983
- const combinedSchemas = schema.oneOf || schema.anyOf || schema.allOf;
49997
+ const combinedSchemas = schema.oneOf || schema.anyOf || schema.allOf;
49998
+ if (schema.type === "object" || schema.type === void 0 && combinedSchemas) {
49999
+ if (combinedSchemas) {
49984
50000
  const shouldCast = !!schema.oneOf || !!schema.anyOf;
49985
50001
  const combinedSchemasFormData = combinedSchemas.map((schema2) => {
49986
50002
  const { schema: combinedSchema, imports: imports2 } = resolveRef(
@@ -50241,9 +50257,13 @@ var getObject = ({
50241
50257
  });
50242
50258
  }
50243
50259
  if (item.properties && Object.entries(item.properties).length > 0) {
50244
- return Object.entries(item.properties).sort((a3, b3) => {
50245
- return a3[0].localeCompare(b3[0]);
50246
- }).reduce(
50260
+ const entries = Object.entries(item.properties);
50261
+ if (context.output.propertySortOrder === PropertySortOrder.ALPHABETICAL) {
50262
+ entries.sort((a3, b3) => {
50263
+ return a3[0].localeCompare(b3[0]);
50264
+ });
50265
+ }
50266
+ return entries.reduce(
50247
50267
  (acc, [key, schema], index3, arr) => {
50248
50268
  const isRequired = (Array.isArray(item.required) ? item.required : []).includes(key);
50249
50269
  let propName = "";
@@ -50369,7 +50389,8 @@ var getScalar = ({
50369
50389
  context
50370
50390
  }) => {
50371
50391
  const isAngularClient = context.output.client === OutputClient.ANGULAR;
50372
- const nullable = item.nullable && !isAngularClient ? " | null" : "";
50392
+ const typeIncludesNull = Array.isArray(item.type) && item.type.includes("null");
50393
+ const nullable = (typeIncludesNull || item.nullable) && !isAngularClient ? " | null" : "";
50373
50394
  const enumItems = item.enum?.filter((enumItem) => enumItem !== null);
50374
50395
  if (!item.type && item.items) {
50375
50396
  item.type = "array";
@@ -50825,7 +50846,7 @@ var getParams = ({
50825
50846
  if (output.allParamsOptional) {
50826
50847
  paramType = `${paramType} | undefined | null`;
50827
50848
  }
50828
- const definition = `${name}${!required || resolvedValue.originalSchema.default ? "?" : ""}: ${resolvedValue.value}`;
50849
+ const definition = `${name}${!required || resolvedValue.originalSchema.default ? "?" : ""}: ${paramType}`;
50829
50850
  const implementation = `${name}${!required && !resolvedValue.originalSchema.default ? "?" : ""}${!resolvedValue.originalSchema.default ? `: ${paramType}` : `: ${paramType} = ${stringify(resolvedValue.originalSchema.default)}`}`;
50830
50851
  return {
50831
50852
  name,
@@ -51108,6 +51129,50 @@ var getRoute = (route) => {
51108
51129
  return `${acc}/${getRoutePath(path2)}`;
51109
51130
  }, "");
51110
51131
  };
51132
+ var getFullRoute = (route, servers, baseUrl) => {
51133
+ const getBaseUrl = () => {
51134
+ if (!baseUrl) return "";
51135
+ if (typeof baseUrl === "string") return baseUrl;
51136
+ if (baseUrl.getBaseUrlFromSpecification) {
51137
+ if (!servers) {
51138
+ throw new Error(
51139
+ "Orval is configured to use baseUrl from the specifications 'servers' field, but there exist no servers in the specification."
51140
+ );
51141
+ }
51142
+ const server = servers.at(
51143
+ Math.min(baseUrl.index ?? 0, servers.length - 1)
51144
+ );
51145
+ if (!server) return "";
51146
+ if (!server.variables) return server.url;
51147
+ let url = server.url;
51148
+ const variables = baseUrl.variables;
51149
+ for (const variableKey of Object.keys(server.variables)) {
51150
+ const variable = server.variables[variableKey];
51151
+ if (!variables?.[variableKey]) {
51152
+ url = url.replaceAll(`{${variableKey}}`, String(variable.default));
51153
+ } else {
51154
+ if (variable.enum && !variable.enum.some((e3) => e3 == variables[variableKey])) {
51155
+ throw new Error(
51156
+ `Invalid variable value '${variables[variableKey]}' for variable '${variableKey}' when resolving ${server.url}. Valid values are: ${variable.enum.join(", ")}.`
51157
+ );
51158
+ }
51159
+ url = url.replaceAll(`{${variableKey}}`, variables[variableKey]);
51160
+ }
51161
+ }
51162
+ return url;
51163
+ }
51164
+ return baseUrl.baseUrl;
51165
+ };
51166
+ let fullRoute = route;
51167
+ const base2 = getBaseUrl();
51168
+ if (base2) {
51169
+ if (base2.endsWith("/") && route.startsWith("/")) {
51170
+ fullRoute = route.slice(1);
51171
+ }
51172
+ fullRoute = `${base2}${fullRoute}`;
51173
+ }
51174
+ return fullRoute;
51175
+ };
51111
51176
  var getRouteAsArray = (route) => route.replace(TEMPLATE_TAG_IN_PATH_REGEX, "/$1/${").split("/").filter((i3) => i3 !== "").map(
51112
51177
  (i3) => (
51113
51178
  // @note - array is mixed with string and var
@@ -51789,7 +51854,7 @@ var generateParameterDefinition = (parameters = {}, context, suffix) => {
51789
51854
  parameter,
51790
51855
  context
51791
51856
  );
51792
- if (schema.in !== "query") {
51857
+ if (schema.in !== "query" && schema.in !== "header") {
51793
51858
  return acc;
51794
51859
  }
51795
51860
  if (!schema.schema || imports.length) {
@@ -51882,8 +51947,8 @@ var generateSchemasDefinition = (schemas = {}, context, suffix, filters) => {
51882
51947
  }
51883
51948
  const transformedSchemas = resolveDiscriminators(schemas, context);
51884
51949
  let generateSchemas = Object.entries(transformedSchemas);
51885
- if (filters) {
51886
- const schemasFilters = filters.schemas || [];
51950
+ if (filters?.schemas) {
51951
+ const schemasFilters = filters.schemas;
51887
51952
  const mode = filters.mode || "include";
51888
51953
  generateSchemas = generateSchemas.filter(([schemaName]) => {
51889
51954
  const isMatch = schemasFilters.some(
@@ -52296,6 +52361,13 @@ type NonReadonly<T> = [T] extends [UnionToIntersection<T>] ? {
52296
52361
  // src/writers/single-mode.ts
52297
52362
  var import_fs_extra3 = __toESM(require("fs-extra"));
52298
52363
 
52364
+ // src/writers/generate-imports-for-builder.ts
52365
+ var import_lodash12 = __toESM(require("lodash.uniqby"));
52366
+ var generateImportsForBuilder = (output, imports, relativeSchemasPath) => output.schemas && !output.indexFiles ? (0, import_lodash12.default)(imports, "name").map((i3) => ({
52367
+ exports: [i3],
52368
+ dependency: path_exports.joinSafe(relativeSchemasPath, camel(i3.name))
52369
+ })) : [{ exports: imports, dependency: relativeSchemasPath }];
52370
+
52299
52371
  // src/writers/target.ts
52300
52372
  var generateTarget = (builder, options) => {
52301
52373
  const operationNames = Object.values(builder.operations).map(
@@ -52419,17 +52491,17 @@ var writeSingleMode = async ({
52419
52491
  const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(
52420
52492
  output.tsconfig
52421
52493
  );
52494
+ const importsForBuilder = schemasPath ? generateImportsForBuilder(
52495
+ output,
52496
+ imports.filter(
52497
+ (imp) => !importsMock.some((impMock) => imp.name === impMock.name)
52498
+ ),
52499
+ schemasPath
52500
+ ) : [];
52422
52501
  data += builder.imports({
52423
52502
  client: output.client,
52424
52503
  implementation,
52425
- imports: schemasPath ? [
52426
- {
52427
- exports: imports.filter(
52428
- (imp) => !importsMock.some((impMock) => imp.name === impMock.name)
52429
- ),
52430
- dependency: schemasPath
52431
- }
52432
- ] : [],
52504
+ imports: importsForBuilder,
52433
52505
  specsName,
52434
52506
  hasSchemaDir: !!output.schemas,
52435
52507
  isAllowSyntheticDefaultImports,
@@ -52442,9 +52514,10 @@ var writeSingleMode = async ({
52442
52514
  output
52443
52515
  });
52444
52516
  if (output.mock) {
52517
+ const importsMockForBuilder = schemasPath ? generateImportsForBuilder(output, importsMock, schemasPath) : [];
52445
52518
  data += builder.importsMock({
52446
52519
  implementation: implementationMock,
52447
- imports: schemasPath ? [{ exports: importsMock, dependency: schemasPath }] : [],
52520
+ imports: importsMockForBuilder,
52448
52521
  specsName,
52449
52522
  hasSchemaDir: !!output.schemas,
52450
52523
  isAllowSyntheticDefaultImports,
@@ -52521,10 +52594,15 @@ var writeSplitMode = async ({
52521
52594
  const isAllowSyntheticDefaultImports = isSyntheticDefaultImportsAllow(
52522
52595
  output.tsconfig
52523
52596
  );
52597
+ const importsForBuilder = generateImportsForBuilder(
52598
+ output,
52599
+ imports,
52600
+ relativeSchemasPath
52601
+ );
52524
52602
  implementationData += builder.imports({
52525
52603
  client: output.client,
52526
52604
  implementation,
52527
- imports: [{ exports: imports, dependency: relativeSchemasPath }],
52605
+ imports: importsForBuilder,
52528
52606
  specsName,
52529
52607
  hasSchemaDir: !!output.schemas,
52530
52608
  isAllowSyntheticDefaultImports,
@@ -52536,9 +52614,14 @@ var writeSplitMode = async ({
52536
52614
  packageJson: output.packageJson,
52537
52615
  output
52538
52616
  });
52617
+ const importsMockForBuilder = generateImportsForBuilder(
52618
+ output,
52619
+ importsMock,
52620
+ relativeSchemasPath
52621
+ );
52539
52622
  mockData += builder.importsMock({
52540
52623
  implementation: implementationMock,
52541
- imports: [{ exports: importsMock, dependency: relativeSchemasPath }],
52624
+ imports: importsMockForBuilder,
52542
52625
  specsName,
52543
52626
  hasSchemaDir: !!output.schemas,
52544
52627
  isAllowSyntheticDefaultImports,
@@ -52734,7 +52817,6 @@ var generateTargetForTags = (builder, options) => {
52734
52817
  };
52735
52818
 
52736
52819
  // src/writers/split-tags-mode.ts
52737
- var import_lodash12 = __toESM(require("lodash.uniqby"));
52738
52820
  var writeSplitTagsMode = async ({
52739
52821
  builder,
52740
52822
  output,
@@ -52770,10 +52852,11 @@ var writeSplitTagsMode = async ({
52770
52852
  dirname3,
52771
52853
  getFileInfo(output.schemas, { extension: output.fileExtension }).dirname
52772
52854
  ) : "../" + filename + ".schemas";
52773
- const importsForBuilder = output.schemas && !output.indexFiles ? (0, import_lodash12.default)(imports, "name").map((i3) => ({
52774
- exports: [i3],
52775
- dependency: path_exports.join(relativeSchemasPath, camel(i3.name))
52776
- })) : [{ exports: imports, dependency: relativeSchemasPath }];
52855
+ const importsForBuilder = generateImportsForBuilder(
52856
+ output,
52857
+ imports,
52858
+ relativeSchemasPath
52859
+ );
52777
52860
  implementationData += builder.imports({
52778
52861
  client: output.client,
52779
52862
  implementation,
@@ -52789,9 +52872,14 @@ var writeSplitTagsMode = async ({
52789
52872
  packageJson: output.packageJson,
52790
52873
  output
52791
52874
  });
52875
+ const importsMockForBuilder = generateImportsForBuilder(
52876
+ output,
52877
+ importsMock,
52878
+ relativeSchemasPath
52879
+ );
52792
52880
  mockData += builder.importsMock({
52793
52881
  implementation: implementationMock,
52794
- imports: [{ exports: importsMock, dependency: relativeSchemasPath }],
52882
+ imports: importsMockForBuilder,
52795
52883
  specsName,
52796
52884
  hasSchemaDir: !!output.schemas,
52797
52885
  isAllowSyntheticDefaultImports,
@@ -52905,14 +52993,13 @@ var writeTagsMode = async ({
52905
52993
  dirname3,
52906
52994
  getFileInfo(output.schemas, { extension: output.fileExtension }).dirname
52907
52995
  ) : "./" + filename + ".schemas";
52908
- const importsForBuilder = [
52909
- {
52910
- exports: imports.filter(
52911
- (imp) => !importsMock.some((impMock) => imp.name === impMock.name)
52912
- ),
52913
- dependency: schemasPathRelative
52914
- }
52915
- ];
52996
+ const importsForBuilder = generateImportsForBuilder(
52997
+ output,
52998
+ imports.filter(
52999
+ (imp) => !importsMock.some((impMock) => imp.name === impMock.name)
53000
+ ),
53001
+ schemasPathRelative
53002
+ );
52916
53003
  data += builder.imports({
52917
53004
  client: output.client,
52918
53005
  implementation,
@@ -52929,11 +53016,14 @@ var writeTagsMode = async ({
52929
53016
  output
52930
53017
  });
52931
53018
  if (output.mock) {
53019
+ const importsMockForBuilder = generateImportsForBuilder(
53020
+ output,
53021
+ importsMock,
53022
+ schemasPathRelative
53023
+ );
52932
53024
  data += builder.importsMock({
52933
53025
  implementation: implementationMock,
52934
- imports: [
52935
- { exports: importsMock, dependency: schemasPathRelative }
52936
- ],
53026
+ imports: importsMockForBuilder,
52937
53027
  specsName,
52938
53028
  hasSchemaDir: !!output.schemas,
52939
53029
  isAllowSyntheticDefaultImports,
@@ -52994,6 +53084,7 @@ var writeTagsMode = async ({
52994
53084
  OutputHttpClient,
52995
53085
  OutputMockType,
52996
53086
  OutputMode,
53087
+ PropertySortOrder,
52997
53088
  RefComponentSuffix,
52998
53089
  SchemaType,
52999
53090
  TEMPLATE_TAG_REGEX,
@@ -53041,6 +53132,7 @@ var writeTagsMode = async ({
53041
53132
  getEnumImplementation,
53042
53133
  getExtension,
53043
53134
  getFileInfo,
53135
+ getFullRoute,
53044
53136
  getIsBodyVerb,
53045
53137
  getKey,
53046
53138
  getMockFileExtensionByTypeName,