@orval/core 7.2.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
@@ -1,9 +1,11 @@
1
1
  import SwaggerParser from '@apidevtools/swagger-parser';
2
+ import { allLocales } from '@faker-js/faker';
2
3
  import * as openapi3_ts_oas30 from 'openapi3-ts/oas30';
3
4
  import { InfoObject, OperationObject, OpenAPIObject, ResponsesObject, ReferenceObject, RequestBodyObject, ParameterObject, SchemaObject, ComponentsObject, SchemasObject, PathItemObject, ResponseObject, ExampleObject } from 'openapi3-ts/oas30';
4
5
  import swagger2openapi from 'swagger2openapi';
5
- import { allLocales } from '@faker-js/faker';
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,16 +179,18 @@ 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;
166
191
  };
167
192
  type InputFiltersOption = {
193
+ mode?: 'include' | 'exclude';
168
194
  tags?: (string | RegExp)[];
169
195
  schemas?: (string | RegExp)[];
170
196
  };
@@ -201,6 +227,9 @@ declare const OutputMode: {
201
227
  readonly TAGS_SPLIT: "tags-split";
202
228
  };
203
229
  type OutputMode = (typeof OutputMode)[keyof typeof OutputMode];
230
+ type OutputDocsOptions = {
231
+ configPath?: string;
232
+ } & Partial<TypeDocOptions>;
204
233
  declare const OutputMockType: {
205
234
  readonly MSW: "msw";
206
235
  };
@@ -423,7 +452,7 @@ type SwrOptions = {
423
452
  swrInfiniteOptions?: any;
424
453
  };
425
454
  type FetchOptions = {
426
- includeHttpStatusReturnType: boolean;
455
+ includeHttpResponseReturnType: boolean;
427
456
  };
428
457
  type InputTransformerFn = (spec: OpenAPIObject) => OpenAPIObject;
429
458
  type InputTransformer = string | InputTransformerFn;
@@ -970,7 +999,7 @@ declare const generateOptions: ({ route, body, headers, queryParams, response, v
970
999
  }) => string;
971
1000
  declare const generateBodyMutatorConfig: (body: GetterBody, isFormData: boolean, isFormUrlEncoded: boolean) => string;
972
1001
  declare const generateQueryParamsAxiosConfig: (response: GetterResponse, isVue: boolean, queryParams?: GetterQueryParam) => string;
973
- declare const generateMutatorConfig: ({ route, body, headers, queryParams, response, verb, isFormData, isFormUrlEncoded, isBodyVerb, hasSignal, isExactOptionalPropertyTypes, isVue, }: {
1002
+ declare const generateMutatorConfig: ({ route, body, headers, queryParams, response, verb, isFormData, isFormUrlEncoded, hasSignal, isExactOptionalPropertyTypes, isVue, }: {
974
1003
  route: string;
975
1004
  body: GetterBody;
976
1005
  headers?: GetterQueryParam | undefined;
@@ -979,7 +1008,6 @@ declare const generateMutatorConfig: ({ route, body, headers, queryParams, respo
979
1008
  verb: Verbs;
980
1009
  isFormData: boolean;
981
1010
  isFormUrlEncoded: boolean;
982
- isBodyVerb: boolean;
983
1011
  hasSignal: boolean;
984
1012
  isExactOptionalPropertyTypes: boolean;
985
1013
  isVue?: boolean | undefined;
@@ -1000,7 +1028,7 @@ declare const generateParameterDefinition: (parameters: ComponentsObject['parame
1000
1028
  *
1001
1029
  * @param schemas
1002
1030
  */
1003
- declare const generateSchemasDefinition: (schemas: SchemasObject | undefined, context: ContextSpecs, suffix: string, schemasFilters?: InputFiltersOption['schemas']) => GeneratorSchema[];
1031
+ declare const generateSchemasDefinition: (schemas: SchemasObject | undefined, context: ContextSpecs, suffix: string, filters?: InputFiltersOption) => GeneratorSchema[];
1004
1032
 
1005
1033
  declare const generateVerbsOptions: ({ verbs, input, output, route, pathRoute, context, }: {
1006
1034
  verbs: PathItemObject;
@@ -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 "./"
@@ -1381,6 +1410,8 @@ declare const isSyntheticDefaultImportsAllow: (config?: Tsconfig) => boolean;
1381
1410
  */
1382
1411
  declare const ibmOpenapiValidator: (specs: OpenAPIObject) => Promise<void>;
1383
1412
 
1413
+ declare const getIsBodyVerb: (verb: Verbs) => boolean;
1414
+
1384
1415
  declare const writeModelInline: (acc: string, model: string) => string;
1385
1416
  declare const writeModelsInline: (array: GeneratorSchema[]) => string;
1386
1417
  declare const writeSchema: ({ path, schema, target, fileExtension, specKey, isRootKey, specsName, header, }: {
@@ -1419,4 +1450,4 @@ declare const generateTarget: (builder: WriteSpecsBuilder, options: NormalizedOu
1419
1450
 
1420
1451
  declare const generateTargetForTags: (builder: WriteSpecsBuilder, options: NormalizedOutputOptions) => Record<string, GeneratorTarget>;
1421
1452
 
1422
- 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, 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 };