@orval/core 6.19.0 → 6.20.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 +142 -112
- package/dist/index.js +44692 -120
- package/package.json +21 -21
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import SwaggerParser from '@apidevtools/swagger-parser';
|
|
2
2
|
import * as openapi3_ts from 'openapi3-ts';
|
|
3
|
-
import { InfoObject, OperationObject, OpenAPIObject, ResponsesObject, ReferenceObject, RequestBodyObject, ParameterObject, SchemaObject, ComponentsObject, SchemasObject, PathItemObject, ResponseObject } from 'openapi3-ts';
|
|
3
|
+
import { InfoObject, OperationObject, OpenAPIObject, ResponsesObject, ReferenceObject, RequestBodyObject, ParameterObject, SchemaObject, ComponentsObject, SchemasObject, PathItemObject, ResponseObject, ExampleObject } from 'openapi3-ts';
|
|
4
4
|
import swagger2openapi from 'swagger2openapi';
|
|
5
5
|
import { CompareOperator } from 'compare-versions';
|
|
6
6
|
import debug from 'debug';
|
|
@@ -10,14 +10,14 @@ interface Options {
|
|
|
10
10
|
input?: string | InputOptions;
|
|
11
11
|
hooks?: Partial<HooksOptions>;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
type OptionsFn = () => Options | Promise<Options>;
|
|
14
|
+
type OptionsExport = Options | Promise<Options> | OptionsFn;
|
|
15
|
+
type Config = {
|
|
16
16
|
[project: string]: OptionsExport;
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
type ConfigFn = () => Config | Promise<Config>;
|
|
19
|
+
type ConfigExternal = Config | Promise<Config> | ConfigFn;
|
|
20
|
+
type NormalizedConfig = {
|
|
21
21
|
[project: string]: NormalizedOptions;
|
|
22
22
|
};
|
|
23
23
|
interface NormalizedOptions {
|
|
@@ -25,7 +25,7 @@ interface NormalizedOptions {
|
|
|
25
25
|
input: NormalizedInputOptions;
|
|
26
26
|
hooks: NormalizedHookOptions;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
type NormalizedOutputOptions = {
|
|
29
29
|
workspace?: string;
|
|
30
30
|
target?: string;
|
|
31
31
|
schemas?: string;
|
|
@@ -42,7 +42,10 @@ declare type NormalizedOutputOptions = {
|
|
|
42
42
|
indexFiles: boolean;
|
|
43
43
|
baseUrl?: string;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
type NormalizedParamsSerializerOptions = {
|
|
46
|
+
qs?: Record<string, any>;
|
|
47
|
+
};
|
|
48
|
+
type NormalizedOverrideOutput = {
|
|
46
49
|
title?: (title: string) => string;
|
|
47
50
|
transformer?: OutputTransformer;
|
|
48
51
|
mutator?: NormalizedMutator;
|
|
@@ -62,11 +65,14 @@ declare type NormalizedOverrideOutput = {
|
|
|
62
65
|
required?: boolean;
|
|
63
66
|
baseUrl?: string;
|
|
64
67
|
delay?: number | (() => number);
|
|
68
|
+
useExamples?: boolean;
|
|
65
69
|
};
|
|
66
70
|
contentType?: OverrideOutputContentType;
|
|
67
71
|
header: false | ((info: InfoObject) => string[] | string);
|
|
68
72
|
formData: boolean | NormalizedMutator;
|
|
69
73
|
formUrlEncoded: boolean | NormalizedMutator;
|
|
74
|
+
paramsSerializer?: NormalizedMutator;
|
|
75
|
+
paramsSerializerOptions?: NormalizedParamsSerializerOptions;
|
|
70
76
|
components: {
|
|
71
77
|
schemas: {
|
|
72
78
|
suffix: string;
|
|
@@ -94,13 +100,13 @@ declare type NormalizedOverrideOutput = {
|
|
|
94
100
|
useBigInt?: boolean;
|
|
95
101
|
useNamedParameters?: boolean;
|
|
96
102
|
};
|
|
97
|
-
|
|
103
|
+
type NormalizedMutator = {
|
|
98
104
|
path: string;
|
|
99
105
|
name?: string;
|
|
100
106
|
default: boolean;
|
|
101
107
|
alias?: Record<string, string>;
|
|
102
108
|
};
|
|
103
|
-
|
|
109
|
+
type NormalizedOperationOptions = {
|
|
104
110
|
transformer?: OutputTransformer;
|
|
105
111
|
mutator?: NormalizedMutator;
|
|
106
112
|
mock?: {
|
|
@@ -116,9 +122,10 @@ declare type NormalizedOperationOptions = {
|
|
|
116
122
|
operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
|
|
117
123
|
formData?: boolean | NormalizedMutator;
|
|
118
124
|
formUrlEncoded?: boolean | NormalizedMutator;
|
|
125
|
+
paramsSerializer?: NormalizedMutator;
|
|
119
126
|
requestOptions?: object | boolean;
|
|
120
127
|
};
|
|
121
|
-
|
|
128
|
+
type NormalizedInputOptions = {
|
|
122
129
|
target: string | Record<string, unknown> | OpenAPIObject;
|
|
123
130
|
validation: boolean;
|
|
124
131
|
override: OverrideInput;
|
|
@@ -128,8 +135,8 @@ declare type NormalizedInputOptions = {
|
|
|
128
135
|
tags?: (string | RegExp)[];
|
|
129
136
|
};
|
|
130
137
|
};
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
type OutputClientFunc = (clients: GeneratorClients) => ClientGeneratorsBuilder;
|
|
139
|
+
type OutputOptions = {
|
|
133
140
|
workspace?: string;
|
|
134
141
|
target?: string;
|
|
135
142
|
schemas?: string;
|
|
@@ -146,10 +153,10 @@ declare type OutputOptions = {
|
|
|
146
153
|
indexFiles?: boolean;
|
|
147
154
|
baseUrl?: string;
|
|
148
155
|
};
|
|
149
|
-
|
|
156
|
+
type SwaggerParserOptions = Omit<SwaggerParser.Options, 'validate'> & {
|
|
150
157
|
validate?: boolean;
|
|
151
158
|
};
|
|
152
|
-
|
|
159
|
+
type InputOptions = {
|
|
153
160
|
target: string | Record<string, unknown> | OpenAPIObject;
|
|
154
161
|
validation?: boolean;
|
|
155
162
|
override?: OverrideInput;
|
|
@@ -159,7 +166,7 @@ declare type InputOptions = {
|
|
|
159
166
|
tags?: string[];
|
|
160
167
|
};
|
|
161
168
|
};
|
|
162
|
-
|
|
169
|
+
type OutputClient = 'axios' | 'axios-functions' | 'angular' | 'react-query' | 'svelte-query' | 'vue-query' | 'swr' | 'zod';
|
|
163
170
|
declare const OutputClient: {
|
|
164
171
|
ANGULAR: OutputClient;
|
|
165
172
|
AXIOS: OutputClient;
|
|
@@ -168,14 +175,14 @@ declare const OutputClient: {
|
|
|
168
175
|
SVELTE_QUERY: OutputClient;
|
|
169
176
|
VUE_QUERY: OutputClient;
|
|
170
177
|
};
|
|
171
|
-
|
|
178
|
+
type OutputMode = 'single' | 'split' | 'tags' | 'tags-split';
|
|
172
179
|
declare const OutputMode: {
|
|
173
180
|
SINGLE: OutputMode;
|
|
174
181
|
SPLIT: OutputMode;
|
|
175
182
|
TAGS: OutputMode;
|
|
176
183
|
TAGS_SPLIT: OutputMode;
|
|
177
184
|
};
|
|
178
|
-
|
|
185
|
+
type MockOptions = {
|
|
179
186
|
arrayMin?: number;
|
|
180
187
|
arrayMax?: number;
|
|
181
188
|
required?: boolean;
|
|
@@ -188,21 +195,24 @@ declare type MockOptions = {
|
|
|
188
195
|
properties: Record<string, string>;
|
|
189
196
|
}>;
|
|
190
197
|
};
|
|
191
|
-
|
|
198
|
+
type MockProperties = {
|
|
192
199
|
[key: string]: unknown;
|
|
193
200
|
} | ((specs: OpenAPIObject) => {
|
|
194
201
|
[key: string]: unknown;
|
|
195
202
|
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
203
|
+
type OutputTransformerFn = (verb: GeneratorVerbOptions) => GeneratorVerbOptions;
|
|
204
|
+
type OutputTransformer = string | OutputTransformerFn;
|
|
205
|
+
type MutatorObject = {
|
|
199
206
|
path: string;
|
|
200
207
|
name?: string;
|
|
201
208
|
default?: boolean;
|
|
202
209
|
alias?: Record<string, string>;
|
|
203
210
|
};
|
|
204
|
-
|
|
205
|
-
|
|
211
|
+
type Mutator = string | MutatorObject;
|
|
212
|
+
type ParamsSerializerOptions = {
|
|
213
|
+
qs?: Record<string, any>;
|
|
214
|
+
};
|
|
215
|
+
type OverrideOutput = {
|
|
206
216
|
title?: (title: string) => string;
|
|
207
217
|
transformer?: OutputTransformer;
|
|
208
218
|
mutator?: Mutator;
|
|
@@ -222,11 +232,14 @@ declare type OverrideOutput = {
|
|
|
222
232
|
required?: boolean;
|
|
223
233
|
baseUrl?: string;
|
|
224
234
|
delay?: number;
|
|
235
|
+
useExamples?: boolean;
|
|
225
236
|
};
|
|
226
237
|
contentType?: OverrideOutputContentType;
|
|
227
238
|
header?: boolean | ((info: InfoObject) => string[] | string);
|
|
228
239
|
formData?: boolean | Mutator;
|
|
229
240
|
formUrlEncoded?: boolean | Mutator;
|
|
241
|
+
paramsSerializer?: Mutator;
|
|
242
|
+
paramsSerializerOptions?: ParamsSerializerOptions;
|
|
230
243
|
components?: {
|
|
231
244
|
schemas?: {
|
|
232
245
|
suffix?: string;
|
|
@@ -254,17 +267,18 @@ declare type OverrideOutput = {
|
|
|
254
267
|
useBigInt?: boolean;
|
|
255
268
|
useNamedParameters?: boolean;
|
|
256
269
|
};
|
|
257
|
-
|
|
270
|
+
type OverrideOutputContentType = {
|
|
258
271
|
include?: string[];
|
|
259
272
|
exclude?: string[];
|
|
260
273
|
};
|
|
261
|
-
|
|
274
|
+
type NormalizedQueryOptions = {
|
|
262
275
|
useQuery?: boolean;
|
|
263
276
|
useSuspenseQuery?: boolean;
|
|
264
277
|
useMutation?: boolean;
|
|
265
278
|
useInfinite?: boolean;
|
|
266
279
|
useSuspenseInfiniteQuery?: boolean;
|
|
267
280
|
useInfiniteQueryParam?: string;
|
|
281
|
+
usePrefetch?: boolean;
|
|
268
282
|
options?: any;
|
|
269
283
|
queryKey?: NormalizedMutator;
|
|
270
284
|
queryOptions?: NormalizedMutator;
|
|
@@ -272,13 +286,14 @@ declare type NormalizedQueryOptions = {
|
|
|
272
286
|
signal?: boolean;
|
|
273
287
|
version?: 3 | 4 | 5;
|
|
274
288
|
};
|
|
275
|
-
|
|
289
|
+
type QueryOptions = {
|
|
276
290
|
useQuery?: boolean;
|
|
277
291
|
useSuspenseQuery?: boolean;
|
|
278
292
|
useMutation?: boolean;
|
|
279
293
|
useInfinite?: boolean;
|
|
280
294
|
useSuspenseInfiniteQuery?: boolean;
|
|
281
295
|
useInfiniteQueryParam?: string;
|
|
296
|
+
usePrefetch?: boolean;
|
|
282
297
|
options?: any;
|
|
283
298
|
queryKey?: Mutator;
|
|
284
299
|
queryOptions?: Mutator;
|
|
@@ -286,15 +301,15 @@ declare type QueryOptions = {
|
|
|
286
301
|
signal?: boolean;
|
|
287
302
|
version?: 3 | 4 | 5;
|
|
288
303
|
};
|
|
289
|
-
|
|
304
|
+
type AngularOptions = {
|
|
290
305
|
provideIn?: 'root' | 'any' | boolean;
|
|
291
306
|
};
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
307
|
+
type InputTransformerFn = (spec: OpenAPIObject) => OpenAPIObject;
|
|
308
|
+
type InputTransformer = string | InputTransformerFn;
|
|
309
|
+
type OverrideInput = {
|
|
295
310
|
transformer?: InputTransformer;
|
|
296
311
|
};
|
|
297
|
-
|
|
312
|
+
type OperationOptions = {
|
|
298
313
|
transformer?: OutputTransformer;
|
|
299
314
|
mutator?: Mutator;
|
|
300
315
|
mock?: {
|
|
@@ -309,15 +324,16 @@ declare type OperationOptions = {
|
|
|
309
324
|
operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
|
|
310
325
|
formData?: boolean | Mutator;
|
|
311
326
|
formUrlEncoded?: boolean | Mutator;
|
|
327
|
+
paramsSerializer?: Mutator;
|
|
312
328
|
requestOptions?: object | boolean;
|
|
313
329
|
};
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
330
|
+
type Hook = 'afterAllFilesWrite';
|
|
331
|
+
type HookFunction = (...args: any[]) => void | Promise<void>;
|
|
332
|
+
type HookCommand = string | HookFunction | (string | HookFunction)[];
|
|
333
|
+
type NormalizedHookCommand = HookCommand[];
|
|
334
|
+
type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<Record<Hook, T>>;
|
|
335
|
+
type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;
|
|
336
|
+
type Verbs = 'post' | 'put' | 'get' | 'patch' | 'delete' | 'head';
|
|
321
337
|
declare const Verbs: {
|
|
322
338
|
POST: Verbs;
|
|
323
339
|
PUT: Verbs;
|
|
@@ -326,7 +342,7 @@ declare const Verbs: {
|
|
|
326
342
|
DELETE: Verbs;
|
|
327
343
|
HEAD: Verbs;
|
|
328
344
|
};
|
|
329
|
-
|
|
345
|
+
type ImportOpenApi = {
|
|
330
346
|
data: Record<string, unknown | OpenAPIObject>;
|
|
331
347
|
input: InputOptions;
|
|
332
348
|
output: NormalizedOutputOptions;
|
|
@@ -368,17 +384,17 @@ interface Tsconfig {
|
|
|
368
384
|
target?: TsConfigTarget;
|
|
369
385
|
};
|
|
370
386
|
}
|
|
371
|
-
|
|
387
|
+
type TsConfigTarget = 'es3' | 'es5' | 'es6' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021' | 'es2022' | 'esnext';
|
|
372
388
|
interface PackageJson {
|
|
373
389
|
dependencies?: Record<string, string>;
|
|
374
390
|
devDependencies?: Record<string, string>;
|
|
375
391
|
}
|
|
376
|
-
|
|
392
|
+
type GeneratorSchema = {
|
|
377
393
|
name: string;
|
|
378
394
|
model: string;
|
|
379
395
|
imports: GeneratorImport[];
|
|
380
396
|
};
|
|
381
|
-
|
|
397
|
+
type GeneratorImport = {
|
|
382
398
|
name: string;
|
|
383
399
|
schemaName?: string;
|
|
384
400
|
alias?: string;
|
|
@@ -387,18 +403,18 @@ declare type GeneratorImport = {
|
|
|
387
403
|
values?: boolean;
|
|
388
404
|
syntheticDefaultImport?: boolean;
|
|
389
405
|
};
|
|
390
|
-
|
|
406
|
+
type GeneratorDependency = {
|
|
391
407
|
exports: GeneratorImport[];
|
|
392
408
|
dependency: string;
|
|
393
409
|
};
|
|
394
|
-
|
|
410
|
+
type GeneratorApiResponse = {
|
|
395
411
|
operations: GeneratorOperations;
|
|
396
412
|
schemas: GeneratorSchema[];
|
|
397
413
|
};
|
|
398
|
-
|
|
414
|
+
type GeneratorOperations = {
|
|
399
415
|
[operationId: string]: GeneratorOperation;
|
|
400
416
|
};
|
|
401
|
-
|
|
417
|
+
type GeneratorTarget = {
|
|
402
418
|
imports: GeneratorImport[];
|
|
403
419
|
implementation: string;
|
|
404
420
|
implementationMSW: string;
|
|
@@ -407,8 +423,9 @@ declare type GeneratorTarget = {
|
|
|
407
423
|
clientMutators?: GeneratorMutator[];
|
|
408
424
|
formData?: GeneratorMutator[];
|
|
409
425
|
formUrlEncoded?: GeneratorMutator[];
|
|
426
|
+
paramsSerializer?: GeneratorMutator[];
|
|
410
427
|
};
|
|
411
|
-
|
|
428
|
+
type GeneratorTargetFull = {
|
|
412
429
|
imports: GeneratorImport[];
|
|
413
430
|
implementation: string;
|
|
414
431
|
implementationMSW: {
|
|
@@ -420,8 +437,9 @@ declare type GeneratorTargetFull = {
|
|
|
420
437
|
clientMutators?: GeneratorMutator[];
|
|
421
438
|
formData?: GeneratorMutator[];
|
|
422
439
|
formUrlEncoded?: GeneratorMutator[];
|
|
440
|
+
paramsSerializer?: GeneratorMutator[];
|
|
423
441
|
};
|
|
424
|
-
|
|
442
|
+
type GeneratorOperation = {
|
|
425
443
|
imports: GeneratorImport[];
|
|
426
444
|
implementation: string;
|
|
427
445
|
implementationMSW: {
|
|
@@ -434,12 +452,13 @@ declare type GeneratorOperation = {
|
|
|
434
452
|
clientMutators?: GeneratorMutator[];
|
|
435
453
|
formData?: GeneratorMutator;
|
|
436
454
|
formUrlEncoded?: GeneratorMutator;
|
|
455
|
+
paramsSerializer?: GeneratorMutator;
|
|
437
456
|
operationName: string;
|
|
438
457
|
types?: {
|
|
439
458
|
result: (title?: string) => string;
|
|
440
459
|
};
|
|
441
460
|
};
|
|
442
|
-
|
|
461
|
+
type GeneratorVerbOptions = {
|
|
443
462
|
verb: Verbs;
|
|
444
463
|
summary?: string;
|
|
445
464
|
doc: string;
|
|
@@ -455,12 +474,13 @@ declare type GeneratorVerbOptions = {
|
|
|
455
474
|
mutator?: GeneratorMutator;
|
|
456
475
|
formData?: GeneratorMutator;
|
|
457
476
|
formUrlEncoded?: GeneratorMutator;
|
|
477
|
+
paramsSerializer?: GeneratorMutator;
|
|
458
478
|
override: NormalizedOverrideOutput;
|
|
459
479
|
deprecated?: boolean;
|
|
460
480
|
originalOperation: OperationObject;
|
|
461
481
|
};
|
|
462
|
-
|
|
463
|
-
|
|
482
|
+
type GeneratorVerbsOptions = GeneratorVerbOptions[];
|
|
483
|
+
type GeneratorOptions = {
|
|
464
484
|
route: string;
|
|
465
485
|
pathRoute: string;
|
|
466
486
|
override: NormalizedOverrideOutput;
|
|
@@ -468,16 +488,16 @@ declare type GeneratorOptions = {
|
|
|
468
488
|
mock: boolean;
|
|
469
489
|
output: string;
|
|
470
490
|
};
|
|
471
|
-
|
|
491
|
+
type GeneratorClient = {
|
|
472
492
|
implementation: string;
|
|
473
493
|
imports: GeneratorImport[];
|
|
474
494
|
mutators?: GeneratorMutator[];
|
|
475
495
|
};
|
|
476
|
-
|
|
496
|
+
type GeneratorMutatorParsingInfo = {
|
|
477
497
|
numberOfParams: number;
|
|
478
498
|
returnNumberOfParams?: number;
|
|
479
499
|
};
|
|
480
|
-
|
|
500
|
+
type GeneratorMutator = {
|
|
481
501
|
name: string;
|
|
482
502
|
path: string;
|
|
483
503
|
default: boolean;
|
|
@@ -488,8 +508,8 @@ declare type GeneratorMutator = {
|
|
|
488
508
|
isHook: boolean;
|
|
489
509
|
bodyTypeName?: string;
|
|
490
510
|
};
|
|
491
|
-
|
|
492
|
-
|
|
511
|
+
type ClientBuilder = (verbOptions: GeneratorVerbOptions, options: GeneratorOptions, outputClient: OutputClient | OutputClientFunc) => GeneratorClient | Promise<GeneratorClient>;
|
|
512
|
+
type ClientHeaderBuilder = (params: {
|
|
493
513
|
title: string;
|
|
494
514
|
isRequestOptions: boolean;
|
|
495
515
|
isMutator: boolean;
|
|
@@ -498,16 +518,16 @@ declare type ClientHeaderBuilder = (params: {
|
|
|
498
518
|
provideIn: boolean | 'root' | 'any';
|
|
499
519
|
hasAwaitedType: boolean;
|
|
500
520
|
}) => string;
|
|
501
|
-
|
|
521
|
+
type ClientFooterBuilder = (params: {
|
|
502
522
|
noFunction?: boolean | undefined;
|
|
503
523
|
operationNames: string[];
|
|
504
524
|
title?: string;
|
|
505
525
|
hasAwaitedType: boolean;
|
|
506
526
|
hasMutator: boolean;
|
|
507
527
|
}) => string;
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
528
|
+
type ClientTitleBuilder = (title: string) => string;
|
|
529
|
+
type ClientDependenciesBuilder = (hasGlobalMutator: boolean, hasParamsSerializerOptions: boolean, packageJson?: PackageJson) => GeneratorDependency[];
|
|
530
|
+
type ClientMSWBuilder = (verbOptions: GeneratorVerbOptions, generatorOptions: GeneratorOptions) => {
|
|
511
531
|
imports: string[];
|
|
512
532
|
implementation: string;
|
|
513
533
|
};
|
|
@@ -518,8 +538,8 @@ interface ClientGeneratorsBuilder {
|
|
|
518
538
|
footer?: ClientFooterBuilder;
|
|
519
539
|
title?: ClientTitleBuilder;
|
|
520
540
|
}
|
|
521
|
-
|
|
522
|
-
|
|
541
|
+
type GeneratorClients = Record<OutputClient, ClientGeneratorsBuilder>;
|
|
542
|
+
type GetterResponse = {
|
|
523
543
|
imports: GeneratorImport[];
|
|
524
544
|
definition: {
|
|
525
545
|
success: string;
|
|
@@ -534,7 +554,7 @@ declare type GetterResponse = {
|
|
|
534
554
|
schemas: GeneratorSchema[];
|
|
535
555
|
originalSchema?: ResponsesObject;
|
|
536
556
|
};
|
|
537
|
-
|
|
557
|
+
type GetterBody = {
|
|
538
558
|
originalSchema: ReferenceObject | RequestBodyObject;
|
|
539
559
|
imports: GeneratorImport[];
|
|
540
560
|
definition: string;
|
|
@@ -544,7 +564,7 @@ declare type GetterBody = {
|
|
|
544
564
|
formUrlEncoded?: string;
|
|
545
565
|
contentType: string;
|
|
546
566
|
};
|
|
547
|
-
|
|
567
|
+
type GetterParameters = {
|
|
548
568
|
query: {
|
|
549
569
|
parameter: ParameterObject;
|
|
550
570
|
imports: GeneratorImport[];
|
|
@@ -558,7 +578,7 @@ declare type GetterParameters = {
|
|
|
558
578
|
imports: GeneratorImport[];
|
|
559
579
|
}[];
|
|
560
580
|
};
|
|
561
|
-
|
|
581
|
+
type GetterParam = {
|
|
562
582
|
name: string;
|
|
563
583
|
definition: string;
|
|
564
584
|
implementation: string;
|
|
@@ -566,14 +586,14 @@ declare type GetterParam = {
|
|
|
566
586
|
required: boolean;
|
|
567
587
|
imports: GeneratorImport[];
|
|
568
588
|
};
|
|
569
|
-
|
|
570
|
-
|
|
589
|
+
type GetterParams = GetterParam[];
|
|
590
|
+
type GetterQueryParam = {
|
|
571
591
|
schema: GeneratorSchema;
|
|
572
592
|
deps: GeneratorSchema[];
|
|
573
593
|
isOptional: boolean;
|
|
574
594
|
originalSchema?: SchemaObject;
|
|
575
595
|
};
|
|
576
|
-
|
|
596
|
+
type GetterPropType = 'param' | 'body' | 'queryParam' | 'header' | 'namedPathParams';
|
|
577
597
|
declare const GetterPropType: {
|
|
578
598
|
readonly PARAM: "param";
|
|
579
599
|
readonly NAMED_PATH_PARAMS: "namedPathParams";
|
|
@@ -581,22 +601,22 @@ declare const GetterPropType: {
|
|
|
581
601
|
readonly QUERY_PARAM: "queryParam";
|
|
582
602
|
readonly HEADER: "header";
|
|
583
603
|
};
|
|
584
|
-
|
|
604
|
+
type GetterPropBase = {
|
|
585
605
|
name: string;
|
|
586
606
|
definition: string;
|
|
587
607
|
implementation: string;
|
|
588
608
|
default: boolean;
|
|
589
609
|
required: boolean;
|
|
590
610
|
};
|
|
591
|
-
|
|
611
|
+
type GetterProp = GetterPropBase & ({
|
|
592
612
|
type: 'namedPathParams';
|
|
593
613
|
destructured: string;
|
|
594
614
|
schema: GeneratorSchema;
|
|
595
615
|
} | {
|
|
596
616
|
type: Exclude<GetterPropType, 'namedPathParams'>;
|
|
597
617
|
});
|
|
598
|
-
|
|
599
|
-
|
|
618
|
+
type GetterProps = GetterProp[];
|
|
619
|
+
type SchemaType = 'integer' | 'number' | 'string' | 'boolean' | 'object' | 'null' | 'array' | 'enum' | 'unknown';
|
|
600
620
|
declare const SchemaType: {
|
|
601
621
|
integer: string;
|
|
602
622
|
number: string;
|
|
@@ -608,7 +628,7 @@ declare const SchemaType: {
|
|
|
608
628
|
enum: string;
|
|
609
629
|
unknown: string;
|
|
610
630
|
};
|
|
611
|
-
|
|
631
|
+
type ScalarValue = {
|
|
612
632
|
value: string;
|
|
613
633
|
isEnum: boolean;
|
|
614
634
|
hasReadonlyProps: boolean;
|
|
@@ -616,11 +636,13 @@ declare type ScalarValue = {
|
|
|
616
636
|
imports: GeneratorImport[];
|
|
617
637
|
schemas: GeneratorSchema[];
|
|
618
638
|
isRef: boolean;
|
|
639
|
+
example?: any;
|
|
640
|
+
examples?: Record<string, any>;
|
|
619
641
|
};
|
|
620
|
-
|
|
642
|
+
type ResolverValue = ScalarValue & {
|
|
621
643
|
originalSchema: SchemaObject;
|
|
622
644
|
};
|
|
623
|
-
|
|
645
|
+
type ResReqTypesValue = ScalarValue & {
|
|
624
646
|
formData?: string;
|
|
625
647
|
formUrlEncoded?: string;
|
|
626
648
|
isRef?: boolean;
|
|
@@ -629,7 +651,7 @@ declare type ResReqTypesValue = ScalarValue & {
|
|
|
629
651
|
contentType: string;
|
|
630
652
|
originalSchema?: SchemaObject;
|
|
631
653
|
};
|
|
632
|
-
|
|
654
|
+
type WriteSpecsBuilder = {
|
|
633
655
|
operations: GeneratorOperations;
|
|
634
656
|
schemas: Record<string, GeneratorSchema[]>;
|
|
635
657
|
title: GeneratorClientTitle;
|
|
@@ -640,7 +662,7 @@ declare type WriteSpecsBuilder = {
|
|
|
640
662
|
info: InfoObject;
|
|
641
663
|
target: string;
|
|
642
664
|
};
|
|
643
|
-
|
|
665
|
+
type WriteModeProps = {
|
|
644
666
|
builder: WriteSpecsBuilder;
|
|
645
667
|
output: NormalizedOutputOptions;
|
|
646
668
|
workspace: string;
|
|
@@ -648,20 +670,20 @@ declare type WriteModeProps = {
|
|
|
648
670
|
header: string;
|
|
649
671
|
needSchema: boolean;
|
|
650
672
|
};
|
|
651
|
-
|
|
673
|
+
type GeneratorApiOperations = {
|
|
652
674
|
operations: GeneratorOperations;
|
|
653
675
|
schemas: GeneratorSchema[];
|
|
654
676
|
};
|
|
655
|
-
|
|
677
|
+
type GeneratorClientExtra = {
|
|
656
678
|
implementation: string;
|
|
657
679
|
implementationMSW: string;
|
|
658
680
|
};
|
|
659
|
-
|
|
681
|
+
type GeneratorClientTitle = (data: {
|
|
660
682
|
outputClient?: OutputClient | OutputClientFunc;
|
|
661
683
|
title: string;
|
|
662
684
|
customTitleFunc?: (title: string) => string;
|
|
663
685
|
}) => GeneratorClientExtra;
|
|
664
|
-
|
|
686
|
+
type GeneratorClientHeader = (data: {
|
|
665
687
|
outputClient?: OutputClient | OutputClientFunc;
|
|
666
688
|
isRequestOptions: boolean;
|
|
667
689
|
isMutator: boolean;
|
|
@@ -670,14 +692,14 @@ declare type GeneratorClientHeader = (data: {
|
|
|
670
692
|
hasAwaitedType: boolean;
|
|
671
693
|
titles: GeneratorClientExtra;
|
|
672
694
|
}) => GeneratorClientExtra;
|
|
673
|
-
|
|
695
|
+
type GeneratorClientFooter = (data: {
|
|
674
696
|
outputClient: OutputClient | OutputClientFunc;
|
|
675
697
|
operationNames: string[];
|
|
676
698
|
hasMutator: boolean;
|
|
677
699
|
hasAwaitedType: boolean;
|
|
678
700
|
titles: GeneratorClientExtra;
|
|
679
701
|
}) => GeneratorClientExtra;
|
|
680
|
-
|
|
702
|
+
type GeneratorClientImports = (data: {
|
|
681
703
|
client: OutputClient | OutputClientFunc;
|
|
682
704
|
implementation: string;
|
|
683
705
|
imports: {
|
|
@@ -688,9 +710,10 @@ declare type GeneratorClientImports = (data: {
|
|
|
688
710
|
hasSchemaDir: boolean;
|
|
689
711
|
isAllowSyntheticDefaultImports: boolean;
|
|
690
712
|
hasGlobalMutator: boolean;
|
|
713
|
+
hasParamsSerializerOptions: boolean;
|
|
691
714
|
packageJson?: PackageJson;
|
|
692
715
|
}) => string;
|
|
693
|
-
|
|
716
|
+
type GenerateMockImports = (data: {
|
|
694
717
|
implementation: string;
|
|
695
718
|
imports: {
|
|
696
719
|
exports: GeneratorImport[];
|
|
@@ -700,7 +723,7 @@ declare type GenerateMockImports = (data: {
|
|
|
700
723
|
hasSchemaDir: boolean;
|
|
701
724
|
isAllowSyntheticDefaultImports: boolean;
|
|
702
725
|
}) => string;
|
|
703
|
-
|
|
726
|
+
type GeneratorApiBuilder = GeneratorApiOperations & {
|
|
704
727
|
title: GeneratorClientTitle;
|
|
705
728
|
header: GeneratorClientHeader;
|
|
706
729
|
footer: GeneratorClientFooter;
|
|
@@ -754,15 +777,17 @@ declare const generateMutator: ({ output, mutator, name, workspace, tsconfig, }:
|
|
|
754
777
|
}) => Promise<GeneratorMutator | undefined>;
|
|
755
778
|
|
|
756
779
|
declare const generateBodyOptions: (body: GetterBody, isFormData: boolean, isFormUrlEncoded: boolean) => string;
|
|
757
|
-
declare const generateAxiosOptions: ({ response, isExactOptionalPropertyTypes, queryParams, headers, requestOptions, hasSignal, }: {
|
|
780
|
+
declare const generateAxiosOptions: ({ response, isExactOptionalPropertyTypes, queryParams, headers, requestOptions, hasSignal, paramsSerializer, paramsSerializerOptions, }: {
|
|
758
781
|
response: GetterResponse;
|
|
759
782
|
isExactOptionalPropertyTypes: boolean;
|
|
760
783
|
queryParams?: GeneratorSchema | undefined;
|
|
761
784
|
headers?: GeneratorSchema | undefined;
|
|
762
785
|
requestOptions?: boolean | object | undefined;
|
|
763
786
|
hasSignal: boolean;
|
|
787
|
+
paramsSerializer?: GeneratorMutator | undefined;
|
|
788
|
+
paramsSerializerOptions?: ParamsSerializerOptions | undefined;
|
|
764
789
|
}) => string;
|
|
765
|
-
declare const generateOptions: ({ route, body, headers, queryParams, response, verb, requestOptions, isFormData, isFormUrlEncoded, isAngular, isExactOptionalPropertyTypes, hasSignal, }: {
|
|
790
|
+
declare const generateOptions: ({ route, body, headers, queryParams, response, verb, requestOptions, isFormData, isFormUrlEncoded, isAngular, isExactOptionalPropertyTypes, hasSignal, paramsSerializer, paramsSerializerOptions, }: {
|
|
766
791
|
route: string;
|
|
767
792
|
body: GetterBody;
|
|
768
793
|
headers?: GetterQueryParam | undefined;
|
|
@@ -775,6 +800,8 @@ declare const generateOptions: ({ route, body, headers, queryParams, response, v
|
|
|
775
800
|
isAngular?: boolean | undefined;
|
|
776
801
|
isExactOptionalPropertyTypes: boolean;
|
|
777
802
|
hasSignal: boolean;
|
|
803
|
+
paramsSerializer?: GeneratorMutator | undefined;
|
|
804
|
+
paramsSerializerOptions?: ParamsSerializerOptions | undefined;
|
|
778
805
|
}) => string;
|
|
779
806
|
declare const generateBodyMutatorConfig: (body: GetterBody, isFormData: boolean, isFormUrlEncoded: boolean) => string;
|
|
780
807
|
declare const generateQueryParamsAxiosConfig: (response: GetterResponse, queryParams?: GetterQueryParam) => string;
|
|
@@ -836,7 +863,7 @@ declare const getBody: ({ requestBody, operationName, context, contentType, }: {
|
|
|
836
863
|
contentType?: OverrideOutputContentType | undefined;
|
|
837
864
|
}) => GetterBody;
|
|
838
865
|
|
|
839
|
-
|
|
866
|
+
type Separator = 'allOf' | 'anyOf' | 'oneOf';
|
|
840
867
|
declare const combineSchemas: ({ name, schema, separator, context, nullable, }: {
|
|
841
868
|
name?: string | undefined;
|
|
842
869
|
schema: SchemaObject;
|
|
@@ -908,7 +935,7 @@ declare const getQueryParams: ({ queryParams, operationName, context, suffix, }:
|
|
|
908
935
|
suffix?: string | undefined;
|
|
909
936
|
}) => GetterQueryParam | undefined;
|
|
910
937
|
|
|
911
|
-
|
|
938
|
+
type RefComponent = 'schemas' | 'responses' | 'parameters' | 'requestBodies';
|
|
912
939
|
declare const RefComponent: {
|
|
913
940
|
schemas: RefComponent;
|
|
914
941
|
responses: RefComponent;
|
|
@@ -963,11 +990,14 @@ declare const resolveObject: ({ schema, propName, combined, context, }: {
|
|
|
963
990
|
context: ContextSpecs;
|
|
964
991
|
}) => ResolverValue;
|
|
965
992
|
|
|
966
|
-
|
|
993
|
+
type ComponentObject = SchemaObject | ResponseObject | ParameterObject | RequestBodyObject | ReferenceObject;
|
|
967
994
|
declare const resolveRef: <Schema extends ComponentObject = ComponentObject>(schema: ComponentObject, context: ContextSpecs, imports?: GeneratorImport[]) => {
|
|
968
995
|
schema: Schema;
|
|
969
996
|
imports: GeneratorImport[];
|
|
970
997
|
};
|
|
998
|
+
type Example = ExampleObject | ReferenceObject;
|
|
999
|
+
type Examples = Example[] | Record<string, Example> | undefined;
|
|
1000
|
+
declare const resolveExampleRefs: (examples: Examples, context: ContextSpecs) => Examples;
|
|
971
1001
|
|
|
972
1002
|
declare const resolveValue: ({ schema, name, context, }: {
|
|
973
1003
|
schema: SchemaObject | ReferenceObject;
|
|
@@ -1041,8 +1071,8 @@ declare const ibmOpenapiValidatorErrors: (errors: {
|
|
|
1041
1071
|
path: string;
|
|
1042
1072
|
message: string;
|
|
1043
1073
|
}[]) => void;
|
|
1044
|
-
|
|
1045
|
-
|
|
1074
|
+
type LogType = 'error' | 'warn' | 'info';
|
|
1075
|
+
type LogLevel = LogType | 'silent';
|
|
1046
1076
|
interface Logger {
|
|
1047
1077
|
info(msg: string, options?: LogOptions): void;
|
|
1048
1078
|
warn(msg: string, options?: LogOptions): void;
|
|
@@ -1099,7 +1129,7 @@ declare let join: (...paths: string[]) => string;
|
|
|
1099
1129
|
declare let resolve: (...paths: string[]) => string;
|
|
1100
1130
|
declare let extname: (path: string) => string;
|
|
1101
1131
|
declare let dirname: (path: string) => string;
|
|
1102
|
-
declare let basename: (path: string,
|
|
1132
|
+
declare let basename: (path: string, suffix?: string | undefined) => string;
|
|
1103
1133
|
declare let isAbsolute: (path: string) => boolean;
|
|
1104
1134
|
|
|
1105
1135
|
/**
|
|
@@ -1112,32 +1142,32 @@ declare const separator = "/";
|
|
|
1112
1142
|
declare const normalizeSafe: (value: string) => string;
|
|
1113
1143
|
declare const joinSafe: (...values: string[]) => string;
|
|
1114
1144
|
|
|
1115
|
-
declare const path_join: typeof join;
|
|
1116
|
-
declare const path_resolve: typeof resolve;
|
|
1117
|
-
declare const path_extname: typeof extname;
|
|
1118
|
-
declare const path_dirname: typeof dirname;
|
|
1119
1145
|
declare const path_basename: typeof basename;
|
|
1146
|
+
declare const path_dirname: typeof dirname;
|
|
1147
|
+
declare const path_extname: typeof extname;
|
|
1148
|
+
declare const path_getSchemaFileName: typeof getSchemaFileName;
|
|
1149
|
+
declare const path_getSpecName: typeof getSpecName;
|
|
1120
1150
|
declare const path_isAbsolute: typeof isAbsolute;
|
|
1151
|
+
declare const path_join: typeof join;
|
|
1152
|
+
declare const path_joinSafe: typeof joinSafe;
|
|
1153
|
+
declare const path_normalizeSafe: typeof normalizeSafe;
|
|
1121
1154
|
declare const path_relativeSafe: typeof relativeSafe;
|
|
1122
|
-
declare const
|
|
1123
|
-
declare const path_getSchemaFileName: typeof getSchemaFileName;
|
|
1155
|
+
declare const path_resolve: typeof resolve;
|
|
1124
1156
|
declare const path_separator: typeof separator;
|
|
1125
|
-
declare const path_normalizeSafe: typeof normalizeSafe;
|
|
1126
|
-
declare const path_joinSafe: typeof joinSafe;
|
|
1127
1157
|
declare namespace path {
|
|
1128
1158
|
export {
|
|
1129
|
-
path_join as join,
|
|
1130
|
-
path_resolve as resolve,
|
|
1131
|
-
path_extname as extname,
|
|
1132
|
-
path_dirname as dirname,
|
|
1133
1159
|
path_basename as basename,
|
|
1160
|
+
path_dirname as dirname,
|
|
1161
|
+
path_extname as extname,
|
|
1162
|
+
path_getSchemaFileName as getSchemaFileName,
|
|
1163
|
+
path_getSpecName as getSpecName,
|
|
1134
1164
|
path_isAbsolute as isAbsolute,
|
|
1165
|
+
path_join as join,
|
|
1166
|
+
path_joinSafe as joinSafe,
|
|
1167
|
+
path_normalizeSafe as normalizeSafe,
|
|
1135
1168
|
path_relativeSafe as relativeSafe,
|
|
1136
|
-
|
|
1137
|
-
path_getSchemaFileName as getSchemaFileName,
|
|
1169
|
+
path_resolve as resolve,
|
|
1138
1170
|
path_separator as separator,
|
|
1139
|
-
path_normalizeSafe as normalizeSafe,
|
|
1140
|
-
path_joinSafe as joinSafe,
|
|
1141
1171
|
};
|
|
1142
1172
|
}
|
|
1143
1173
|
|
|
@@ -1220,4 +1250,4 @@ declare const generateTarget: (builder: WriteSpecsBuilder, options: NormalizedOu
|
|
|
1220
1250
|
|
|
1221
1251
|
declare const generateTargetForTags: (builder: WriteSpecsBuilder, options: NormalizedOutputOptions) => Record<string, GeneratorTarget>;
|
|
1222
1252
|
|
|
1223
|
-
export { AngularOptions, BODY_TYPE_NAME, ClientBuilder, ClientDependenciesBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder, ClientMSWBuilder, ClientTitleBuilder, Config, ConfigExternal, ConfigFn, ContextSpecs, GenerateMockImports, GeneratorApiBuilder, GeneratorApiOperations, GeneratorApiResponse, GeneratorClient, GeneratorClientExtra, GeneratorClientFooter, GeneratorClientHeader, GeneratorClientImports, GeneratorClientTitle, GeneratorClients, GeneratorDependency, GeneratorImport, GeneratorMutator, GeneratorMutatorParsingInfo, GeneratorOperation, GeneratorOperations, GeneratorOptions, GeneratorSchema, GeneratorTarget, GeneratorTargetFull, GeneratorVerbOptions, GeneratorVerbsOptions, GetterBody, GetterParam, GetterParameters, GetterParams, GetterProp, GetterPropType, GetterProps, GetterQueryParam, GetterResponse, GlobalOptions, Hook, HookCommand, HookFunction, HooksOptions, ImportOpenApi, InputOptions, InputTransformerFn, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, MockOptions, MockProperties, Mutator, MutatorObject, NormalizedHookCommand, NormalizedHookOptions, NormalizedInputOptions, NormalizedMutator, NormalizedOperationOptions, NormalizedOptions, NormalizedOutputOptions, NormalizedOverrideOutput,
|
|
1253
|
+
export { AngularOptions, BODY_TYPE_NAME, ClientBuilder, ClientDependenciesBuilder, ClientFooterBuilder, ClientGeneratorsBuilder, ClientHeaderBuilder, ClientMSWBuilder, ClientTitleBuilder, Config, ConfigExternal, ConfigFn, ContextSpecs, GenerateMockImports, GeneratorApiBuilder, GeneratorApiOperations, GeneratorApiResponse, GeneratorClient, GeneratorClientExtra, GeneratorClientFooter, GeneratorClientHeader, GeneratorClientImports, GeneratorClientTitle, GeneratorClients, GeneratorDependency, GeneratorImport, GeneratorMutator, GeneratorMutatorParsingInfo, GeneratorOperation, GeneratorOperations, GeneratorOptions, GeneratorSchema, GeneratorTarget, GeneratorTargetFull, GeneratorVerbOptions, GeneratorVerbsOptions, GetterBody, GetterParam, GetterParameters, GetterParams, GetterProp, GetterPropType, GetterProps, GetterQueryParam, GetterResponse, GlobalOptions, Hook, HookCommand, HookFunction, HooksOptions, ImportOpenApi, InputOptions, InputTransformerFn, LogLevel, LogLevels, LogOptions, LogType, Logger, LoggerOptions, MockOptions, MockProperties, Mutator, MutatorObject, NormalizedConfig, NormalizedHookCommand, NormalizedHookOptions, NormalizedInputOptions, NormalizedMutator, NormalizedOperationOptions, NormalizedOptions, NormalizedOutputOptions, NormalizedOverrideOutput, NormalizedParamsSerializerOptions, NormalizedQueryOptions, OperationOptions, Options, OptionsExport, OptionsFn, OutputClient, OutputClientFunc, OutputMode, OutputOptions, OverrideInput, OverrideOutput, OverrideOutputContentType, PackageJson, ParamsSerializerOptions, QueryOptions, RefComponentSuffix, RefInfo, ResReqTypesValue, ResolverValue, ScalarValue, SchemaType, SwaggerParserOptions, TsConfigTarget, Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, WriteModeProps, 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, 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 };
|