@orval/core 6.22.1 → 6.24.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,6 +1,6 @@
1
1
  import SwaggerParser from '@apidevtools/swagger-parser';
2
- import * as openapi3_ts from 'openapi3-ts';
3
- import { InfoObject, OperationObject, OpenAPIObject, ResponsesObject, ReferenceObject, RequestBodyObject, ParameterObject, SchemaObject, ComponentsObject, SchemasObject, PathItemObject, ResponseObject, ExampleObject } from 'openapi3-ts';
2
+ import * as openapi3_ts_oas30 from 'openapi3-ts/oas30';
3
+ import { InfoObject, OperationObject, OpenAPIObject, ResponsesObject, ReferenceObject, RequestBodyObject, ParameterObject, SchemaObject, ComponentsObject, SchemasObject, PathItemObject, ResponseObject, ExampleObject } from 'openapi3-ts/oas30';
4
4
  import swagger2openapi from 'swagger2openapi';
5
5
  import { allLocales } from '@faker-js/faker';
6
6
  import { CompareOperator } from 'compare-versions';
@@ -44,6 +44,7 @@ type NormalizedOutputOptions = {
44
44
  baseUrl?: string;
45
45
  allParamsOptional: boolean;
46
46
  urlEncodeParameters: boolean;
47
+ unionAddMissingProperties: boolean;
47
48
  };
48
49
  type NormalizedParamsSerializerOptions = {
49
50
  qs?: Record<string, any>;
@@ -68,6 +69,7 @@ type NormalizedOverrideOutput = {
68
69
  components: {
69
70
  schemas: {
70
71
  suffix: string;
72
+ itemSuffix: string;
71
73
  };
72
74
  responses: {
73
75
  suffix: string;
@@ -81,9 +83,7 @@ type NormalizedOverrideOutput = {
81
83
  };
82
84
  query: NormalizedQueryOptions;
83
85
  angular: Required<AngularOptions>;
84
- swr: {
85
- options?: any;
86
- };
86
+ swr: SwrOptions;
87
87
  operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
88
88
  requestOptions: Record<string, any> | boolean;
89
89
  useDates?: boolean;
@@ -148,6 +148,7 @@ type OutputOptions = {
148
148
  baseUrl?: string;
149
149
  allParamsOptional?: boolean;
150
150
  urlEncodeParameters?: boolean;
151
+ unionAddMissingProperties?: boolean;
151
152
  };
152
153
  type SwaggerParserOptions = Omit<SwaggerParser.Options, 'validate'> & {
153
154
  validate?: boolean;
@@ -172,18 +173,18 @@ declare const OutputClient: {
172
173
  readonly SWR: "swr";
173
174
  readonly ZOD: "zod";
174
175
  };
175
- type OutputClient = typeof OutputClient[keyof typeof OutputClient];
176
+ type OutputClient = (typeof OutputClient)[keyof typeof OutputClient];
176
177
  declare const OutputMode: {
177
178
  readonly SINGLE: "single";
178
179
  readonly SPLIT: "split";
179
180
  readonly TAGS: "tags";
180
181
  readonly TAGS_SPLIT: "tags-split";
181
182
  };
182
- type OutputMode = typeof OutputMode[keyof typeof OutputMode];
183
+ type OutputMode = (typeof OutputMode)[keyof typeof OutputMode];
183
184
  declare const OutputMockType: {
184
185
  readonly MSW: "msw";
185
186
  };
186
- type OutputMockType = typeof OutputMockType[keyof typeof OutputMockType];
187
+ type OutputMockType = (typeof OutputMockType)[keyof typeof OutputMockType];
187
188
  type GlobalMockOptions = {
188
189
  type: OutputMockType;
189
190
  useExamples?: boolean;
@@ -244,6 +245,7 @@ type OverrideOutput = {
244
245
  components?: {
245
246
  schemas?: {
246
247
  suffix?: string;
248
+ itemSuffix?: string;
247
249
  };
248
250
  responses?: {
249
251
  suffix?: string;
@@ -256,9 +258,7 @@ type OverrideOutput = {
256
258
  };
257
259
  };
258
260
  query?: QueryOptions;
259
- swr?: {
260
- options?: any;
261
- };
261
+ swr?: SwrOptions;
262
262
  angular?: AngularOptions;
263
263
  operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
264
264
  requestOptions?: Record<string, any> | boolean;
@@ -285,6 +285,7 @@ type NormalizedQueryOptions = {
285
285
  queryKey?: NormalizedMutator;
286
286
  queryOptions?: NormalizedMutator;
287
287
  mutationOptions?: NormalizedMutator;
288
+ shouldExportMutatorHooks?: boolean;
288
289
  signal?: boolean;
289
290
  version?: 3 | 4 | 5;
290
291
  };
@@ -300,12 +301,17 @@ type QueryOptions = {
300
301
  queryKey?: Mutator;
301
302
  queryOptions?: Mutator;
302
303
  mutationOptions?: Mutator;
304
+ shouldExportMutatorHooks?: boolean;
303
305
  signal?: boolean;
304
306
  version?: 3 | 4 | 5;
305
307
  };
306
308
  type AngularOptions = {
307
309
  provideIn?: 'root' | 'any' | boolean;
308
310
  };
311
+ type SwrOptions = {
312
+ options?: any;
313
+ useInfinite?: boolean;
314
+ };
309
315
  type InputTransformerFn = (spec: OpenAPIObject) => OpenAPIObject;
310
316
  type InputTransformer = string | InputTransformerFn;
311
317
  type OverrideInput = {
@@ -320,9 +326,7 @@ type OperationOptions = {
320
326
  };
321
327
  query?: QueryOptions;
322
328
  angular?: Required<AngularOptions>;
323
- swr?: {
324
- options?: any;
325
- };
329
+ swr?: SwrOptions;
326
330
  operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
327
331
  formData?: boolean | Mutator;
328
332
  formUrlEncoded?: boolean | Mutator;
@@ -331,7 +335,11 @@ type OperationOptions = {
331
335
  };
332
336
  type Hook = 'afterAllFilesWrite';
333
337
  type HookFunction = (...args: any[]) => void | Promise<void>;
334
- type HookCommand = string | HookFunction | (string | HookFunction)[];
338
+ interface HookOption {
339
+ command: string | HookFunction;
340
+ injectGeneratedDirsAndFiles?: boolean;
341
+ }
342
+ type HookCommand = string | HookFunction | HookOption | (string | HookFunction | HookOption)[];
335
343
  type NormalizedHookCommand = HookCommand[];
336
344
  type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<Record<Hook, T>>;
337
345
  type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;
@@ -355,12 +363,9 @@ interface ContextSpecs {
355
363
  specKey: string;
356
364
  target: string;
357
365
  workspace: string;
358
- tslint: boolean;
359
366
  specs: Record<string, OpenAPIObject>;
360
- override: NormalizedOverrideOutput;
361
- tsconfig?: Tsconfig;
362
- packageJson?: PackageJson;
363
367
  parents?: string[];
368
+ output: NormalizedOutputOptions;
364
369
  }
365
370
  interface GlobalOptions {
366
371
  projectName?: string;
@@ -433,6 +438,7 @@ type GeneratorTargetFull = {
433
438
  implementationMock: {
434
439
  function: string;
435
440
  handler: string;
441
+ handlerName: string;
436
442
  };
437
443
  importsMock: GeneratorImport[];
438
444
  mutators?: GeneratorMutator[];
@@ -447,6 +453,7 @@ type GeneratorOperation = {
447
453
  implementationMock: {
448
454
  function: string;
449
455
  handler: string;
456
+ handlerName: string;
450
457
  };
451
458
  importsMock: GeneratorImport[];
452
459
  tags: string[];
@@ -922,7 +929,7 @@ declare const getParamsInPath: (path: string) => string[];
922
929
  declare const getParams: ({ route, pathParams, operationId, context, output, }: {
923
930
  route: string;
924
931
  pathParams?: {
925
- parameter: openapi3_ts.ParameterObject;
932
+ parameter: openapi3_ts_oas30.ParameterObject;
926
933
  imports: GeneratorImport[];
927
934
  }[] | undefined;
928
935
  operationId: string;
@@ -1071,7 +1078,7 @@ declare const startMessage: ({ name, version, description, }: {
1071
1078
  version: string;
1072
1079
  description: string;
1073
1080
  }) => void;
1074
- declare const errorMessage: (err: string) => void;
1081
+ declare const logError: (err: unknown, tag?: string) => void;
1075
1082
  declare const mismatchArgsMessage: (mismatchArgs: string[]) => void;
1076
1083
  declare const createSuccessMessage: (backend?: string) => void;
1077
1084
  declare const ibmOpenapiValidatorWarnings: (warnings: {
@@ -1250,4 +1257,4 @@ declare const generateTarget: (builder: WriteSpecsBuilder, options: NormalizedOu
1250
1257
 
1251
1258
  declare const generateTargetForTags: (builder: WriteSpecsBuilder, options: NormalizedOutputOptions) => Record<string, GeneratorTarget>;
1252
1259
 
1253
- export { type AngularOptions, BODY_TYPE_NAME, type ClientBuilder, type ClientDependenciesBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, 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 Hook, type HookCommand, type HookFunction, type HooksOptions, type ImportOpenApi, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockOptions, type MockProperties, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, 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 SwaggerParserOptions, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, errorMessage, 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, 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 };
1260
+ export { type AngularOptions, BODY_TYPE_NAME, type ClientBuilder, type ClientDependenciesBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, 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 Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockOptions, type MockProperties, type Mutator, type MutatorObject, type NormalizedConfig, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, 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 SwaggerParserOptions, type SwrOptions, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, _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 };