@orval/core 6.23.0 → 6.25.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 +28 -22
- package/dist/index.js +1231 -1131
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SwaggerParser from '@apidevtools/swagger-parser';
|
|
2
|
-
import * as
|
|
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>;
|
|
@@ -82,9 +83,7 @@ type NormalizedOverrideOutput = {
|
|
|
82
83
|
};
|
|
83
84
|
query: NormalizedQueryOptions;
|
|
84
85
|
angular: Required<AngularOptions>;
|
|
85
|
-
swr:
|
|
86
|
-
options?: any;
|
|
87
|
-
};
|
|
86
|
+
swr: SwrOptions;
|
|
88
87
|
operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
|
|
89
88
|
requestOptions: Record<string, any> | boolean;
|
|
90
89
|
useDates?: boolean;
|
|
@@ -149,6 +148,7 @@ type OutputOptions = {
|
|
|
149
148
|
baseUrl?: string;
|
|
150
149
|
allParamsOptional?: boolean;
|
|
151
150
|
urlEncodeParameters?: boolean;
|
|
151
|
+
unionAddMissingProperties?: boolean;
|
|
152
152
|
};
|
|
153
153
|
type SwaggerParserOptions = Omit<SwaggerParser.Options, 'validate'> & {
|
|
154
154
|
validate?: boolean;
|
|
@@ -173,18 +173,18 @@ declare const OutputClient: {
|
|
|
173
173
|
readonly SWR: "swr";
|
|
174
174
|
readonly ZOD: "zod";
|
|
175
175
|
};
|
|
176
|
-
type OutputClient = typeof OutputClient[keyof typeof OutputClient];
|
|
176
|
+
type OutputClient = (typeof OutputClient)[keyof typeof OutputClient];
|
|
177
177
|
declare const OutputMode: {
|
|
178
178
|
readonly SINGLE: "single";
|
|
179
179
|
readonly SPLIT: "split";
|
|
180
180
|
readonly TAGS: "tags";
|
|
181
181
|
readonly TAGS_SPLIT: "tags-split";
|
|
182
182
|
};
|
|
183
|
-
type OutputMode = typeof OutputMode[keyof typeof OutputMode];
|
|
183
|
+
type OutputMode = (typeof OutputMode)[keyof typeof OutputMode];
|
|
184
184
|
declare const OutputMockType: {
|
|
185
185
|
readonly MSW: "msw";
|
|
186
186
|
};
|
|
187
|
-
type OutputMockType = typeof OutputMockType[keyof typeof OutputMockType];
|
|
187
|
+
type OutputMockType = (typeof OutputMockType)[keyof typeof OutputMockType];
|
|
188
188
|
type GlobalMockOptions = {
|
|
189
189
|
type: OutputMockType;
|
|
190
190
|
useExamples?: boolean;
|
|
@@ -258,9 +258,7 @@ type OverrideOutput = {
|
|
|
258
258
|
};
|
|
259
259
|
};
|
|
260
260
|
query?: QueryOptions;
|
|
261
|
-
swr?:
|
|
262
|
-
options?: any;
|
|
263
|
-
};
|
|
261
|
+
swr?: SwrOptions;
|
|
264
262
|
angular?: AngularOptions;
|
|
265
263
|
operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
|
|
266
264
|
requestOptions?: Record<string, any> | boolean;
|
|
@@ -287,6 +285,7 @@ type NormalizedQueryOptions = {
|
|
|
287
285
|
queryKey?: NormalizedMutator;
|
|
288
286
|
queryOptions?: NormalizedMutator;
|
|
289
287
|
mutationOptions?: NormalizedMutator;
|
|
288
|
+
shouldExportMutatorHooks?: boolean;
|
|
290
289
|
signal?: boolean;
|
|
291
290
|
version?: 3 | 4 | 5;
|
|
292
291
|
};
|
|
@@ -302,12 +301,18 @@ type QueryOptions = {
|
|
|
302
301
|
queryKey?: Mutator;
|
|
303
302
|
queryOptions?: Mutator;
|
|
304
303
|
mutationOptions?: Mutator;
|
|
304
|
+
shouldExportMutatorHooks?: boolean;
|
|
305
305
|
signal?: boolean;
|
|
306
306
|
version?: 3 | 4 | 5;
|
|
307
307
|
};
|
|
308
308
|
type AngularOptions = {
|
|
309
309
|
provideIn?: 'root' | 'any' | boolean;
|
|
310
310
|
};
|
|
311
|
+
type SwrOptions = {
|
|
312
|
+
options?: any;
|
|
313
|
+
useInfinite?: boolean;
|
|
314
|
+
swrOptions?: any;
|
|
315
|
+
};
|
|
311
316
|
type InputTransformerFn = (spec: OpenAPIObject) => OpenAPIObject;
|
|
312
317
|
type InputTransformer = string | InputTransformerFn;
|
|
313
318
|
type OverrideInput = {
|
|
@@ -322,9 +327,7 @@ type OperationOptions = {
|
|
|
322
327
|
};
|
|
323
328
|
query?: QueryOptions;
|
|
324
329
|
angular?: Required<AngularOptions>;
|
|
325
|
-
swr?:
|
|
326
|
-
options?: any;
|
|
327
|
-
};
|
|
330
|
+
swr?: SwrOptions;
|
|
328
331
|
operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
|
|
329
332
|
formData?: boolean | Mutator;
|
|
330
333
|
formUrlEncoded?: boolean | Mutator;
|
|
@@ -333,7 +336,11 @@ type OperationOptions = {
|
|
|
333
336
|
};
|
|
334
337
|
type Hook = 'afterAllFilesWrite';
|
|
335
338
|
type HookFunction = (...args: any[]) => void | Promise<void>;
|
|
336
|
-
|
|
339
|
+
interface HookOption {
|
|
340
|
+
command: string | HookFunction;
|
|
341
|
+
injectGeneratedDirsAndFiles?: boolean;
|
|
342
|
+
}
|
|
343
|
+
type HookCommand = string | HookFunction | HookOption | (string | HookFunction | HookOption)[];
|
|
337
344
|
type NormalizedHookCommand = HookCommand[];
|
|
338
345
|
type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<Record<Hook, T>>;
|
|
339
346
|
type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;
|
|
@@ -357,12 +364,9 @@ interface ContextSpecs {
|
|
|
357
364
|
specKey: string;
|
|
358
365
|
target: string;
|
|
359
366
|
workspace: string;
|
|
360
|
-
tslint: boolean;
|
|
361
367
|
specs: Record<string, OpenAPIObject>;
|
|
362
|
-
override: NormalizedOverrideOutput;
|
|
363
|
-
tsconfig?: Tsconfig;
|
|
364
|
-
packageJson?: PackageJson;
|
|
365
368
|
parents?: string[];
|
|
369
|
+
output: NormalizedOutputOptions;
|
|
366
370
|
}
|
|
367
371
|
interface GlobalOptions {
|
|
368
372
|
projectName?: string;
|
|
@@ -435,6 +439,7 @@ type GeneratorTargetFull = {
|
|
|
435
439
|
implementationMock: {
|
|
436
440
|
function: string;
|
|
437
441
|
handler: string;
|
|
442
|
+
handlerName: string;
|
|
438
443
|
};
|
|
439
444
|
importsMock: GeneratorImport[];
|
|
440
445
|
mutators?: GeneratorMutator[];
|
|
@@ -449,6 +454,7 @@ type GeneratorOperation = {
|
|
|
449
454
|
implementationMock: {
|
|
450
455
|
function: string;
|
|
451
456
|
handler: string;
|
|
457
|
+
handlerName: string;
|
|
452
458
|
};
|
|
453
459
|
importsMock: GeneratorImport[];
|
|
454
460
|
tags: string[];
|
|
@@ -924,7 +930,7 @@ declare const getParamsInPath: (path: string) => string[];
|
|
|
924
930
|
declare const getParams: ({ route, pathParams, operationId, context, output, }: {
|
|
925
931
|
route: string;
|
|
926
932
|
pathParams?: {
|
|
927
|
-
parameter:
|
|
933
|
+
parameter: openapi3_ts_oas30.ParameterObject;
|
|
928
934
|
imports: GeneratorImport[];
|
|
929
935
|
}[] | undefined;
|
|
930
936
|
operationId: string;
|
|
@@ -1073,7 +1079,7 @@ declare const startMessage: ({ name, version, description, }: {
|
|
|
1073
1079
|
version: string;
|
|
1074
1080
|
description: string;
|
|
1075
1081
|
}) => void;
|
|
1076
|
-
declare const
|
|
1082
|
+
declare const logError: (err: unknown, tag?: string) => void;
|
|
1077
1083
|
declare const mismatchArgsMessage: (mismatchArgs: string[]) => void;
|
|
1078
1084
|
declare const createSuccessMessage: (backend?: string) => void;
|
|
1079
1085
|
declare const ibmOpenapiValidatorWarnings: (warnings: {
|
|
@@ -1252,4 +1258,4 @@ declare const generateTarget: (builder: WriteSpecsBuilder, options: NormalizedOu
|
|
|
1252
1258
|
|
|
1253
1259
|
declare const generateTargetForTags: (builder: WriteSpecsBuilder, options: NormalizedOutputOptions) => Record<string, GeneratorTarget>;
|
|
1254
1260
|
|
|
1255
|
-
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,
|
|
1261
|
+
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 };
|