@@ -242,19 +242,19 @@ import { CancelablePromise } from './CancelablePromise';
242
242
import type { OnCancel } from './CancelablePromise';
243
243
import type { OpenAPIConfig } from './OpenAPI';
244
244
245
- const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
245
+ export const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
246
246
return value !== undefined && value !== null;
247
247
};
248
248
249
- const isString = (value: any): value is string => {
249
+ export const isString = (value: any): value is string => {
250
250
return typeof value === 'string';
251
251
};
252
252
253
- const isStringWithValue = (value: any): value is string => {
253
+ export const isStringWithValue = (value: any): value is string => {
254
254
return isString(value) && value !== '';
255
255
};
256
256
257
- const isBlob = (value: any): value is Blob => {
257
+ export const isBlob = (value: any): value is Blob => {
258
258
return (
259
259
typeof value === 'object' &&
260
260
typeof value.type === 'string' &&
@@ -267,11 +267,11 @@ const isBlob = (value: any): value is Blob => {
267
267
);
268
268
};
269
269
270
- const isFormData = (value: any): value is FormData => {
270
+ export const isFormData = (value: any): value is FormData => {
271
271
return value instanceof FormData;
272
272
};
273
273
274
- const base64 = (str: string): string => {
274
+ export const base64 = (str: string): string => {
275
275
try {
276
276
return btoa(str);
277
277
} catch (err) {
@@ -280,7 +280,7 @@ const base64 = (str: string): string => {
280
280
}
281
281
};
282
282
283
- const getQueryString = (params: Record<string, any>): string => {
283
+ export const getQueryString = (params: Record<string, any>): string => {
284
284
const qs: string[] = [];
285
285
286
286
const append = (key: string, value: any) => {
@@ -333,7 +333,7 @@ const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
333
333
return url;
334
334
};
335
335
336
- const getFormData = (options: ApiRequestOptions): FormData | undefined => {
336
+ export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
337
337
if (options.formData) {
338
338
const formData = new FormData();
339
339
@@ -362,14 +362,14 @@ const getFormData = (options: ApiRequestOptions): FormData | undefined => {
362
362
363
363
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
364
364
365
- const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
365
+ export const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
366
366
if (typeof resolver === 'function') {
367
367
return (resolver as Resolver<T>)(options);
368
368
}
369
369
return resolver;
370
370
};
371
371
372
- const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
372
+ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
373
373
const token = await resolve(options, config.TOKEN);
374
374
const username = await resolve(options, config.USERNAME);
375
375
const password = await resolve(options, config.PASSWORD);
@@ -410,7 +410,7 @@ const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Pr
410
410
return new Headers(headers);
411
411
};
412
412
413
- const getRequestBody = (options: ApiRequestOptions): any => {
413
+ export const getRequestBody = (options: ApiRequestOptions): any => {
414
414
if (options.body !== undefined) {
415
415
if (options.mediaType?.includes('/json')) {
416
416
return JSON.stringify(options.body)
@@ -450,7 +450,7 @@ export const sendRequest = async (
450
450
return await fetch(url, request);
451
451
};
452
452
453
- const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {
453
+ export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {
454
454
if (responseHeader) {
455
455
const content = response.headers.get(responseHeader);
456
456
if (isString(content)) {
@@ -460,7 +460,7 @@ const getResponseHeader = (response: Response, responseHeader?: string): string
460
460
return undefined;
461
461
};
462
462
463
- const getResponseBody = async (response: Response): Promise<any> => {
463
+ export const getResponseBody = async (response: Response): Promise<any> => {
464
464
if (response.status !== 204) {
465
465
try {
466
466
const contentType = response.headers.get('Content-Type');
@@ -480,7 +480,7 @@ const getResponseBody = async (response: Response): Promise<any> => {
480
480
return undefined;
481
481
};
482
482
483
- const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
483
+ export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
484
484
const errors: Record<number, string> = {
485
485
400: 'Bad Request',
486
486
401: 'Unauthorized',
@@ -3337,19 +3337,19 @@ import { CancelablePromise } from './CancelablePromise';
3337
3337
import type { OnCancel } from './CancelablePromise';
3338
3338
import type { OpenAPIConfig } from './OpenAPI';
3339
3339
3340
- const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
3340
+ export const isDefined = <T>(value: T | null | undefined): value is Exclude<T, null | undefined> => {
3341
3341
return value !== undefined && value !== null;
3342
3342
};
3343
3343
3344
- const isString = (value: any): value is string => {
3344
+ export const isString = (value: any): value is string => {
3345
3345
return typeof value === 'string';
3346
3346
};
3347
3347
3348
- const isStringWithValue = (value: any): value is string => {
3348
+ export const isStringWithValue = (value: any): value is string => {
3349
3349
return isString(value) && value !== '';
3350
3350
};
3351
3351
3352
- const isBlob = (value: any): value is Blob => {
3352
+ export const isBlob = (value: any): value is Blob => {
3353
3353
return (
3354
3354
typeof value === 'object' &&
3355
3355
typeof value.type === 'string' &&
@@ -3362,11 +3362,11 @@ const isBlob = (value: any): value is Blob => {
3362
3362
);
3363
3363
};
3364
3364
3365
- const isFormData = (value: any): value is FormData => {
3365
+ export const isFormData = (value: any): value is FormData => {
3366
3366
return value instanceof FormData;
3367
3367
};
3368
3368
3369
- const base64 = (str: string): string => {
3369
+ export const base64 = (str: string): string => {
3370
3370
try {
3371
3371
return btoa(str);
3372
3372
} catch (err) {
@@ -3375,7 +3375,7 @@ const base64 = (str: string): string => {
3375
3375
}
3376
3376
};
3377
3377
3378
- const getQueryString = (params: Record<string, any>): string => {
3378
+ export const getQueryString = (params: Record<string, any>): string => {
3379
3379
const qs: string[] = [];
3380
3380
3381
3381
const append = (key: string, value: any) => {
@@ -3428,7 +3428,7 @@ const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => {
3428
3428
return url;
3429
3429
};
3430
3430
3431
- const getFormData = (options: ApiRequestOptions): FormData | undefined => {
3431
+ export const getFormData = (options: ApiRequestOptions): FormData | undefined => {
3432
3432
if (options.formData) {
3433
3433
const formData = new FormData();
3434
3434
@@ -3457,14 +3457,14 @@ const getFormData = (options: ApiRequestOptions): FormData | undefined => {
3457
3457
3458
3458
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
3459
3459
3460
- const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
3460
+ export const resolve = async <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>): Promise<T | undefined> => {
3461
3461
if (typeof resolver === 'function') {
3462
3462
return (resolver as Resolver<T>)(options);
3463
3463
}
3464
3464
return resolver;
3465
3465
};
3466
3466
3467
- const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
3467
+ export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise<Headers> => {
3468
3468
const token = await resolve(options, config.TOKEN);
3469
3469
const username = await resolve(options, config.USERNAME);
3470
3470
const password = await resolve(options, config.PASSWORD);
@@ -3505,7 +3505,7 @@ const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Pr
3505
3505
return new Headers(headers);
3506
3506
};
3507
3507
3508
- const getRequestBody = (options: ApiRequestOptions): any => {
3508
+ export const getRequestBody = (options: ApiRequestOptions): any => {
3509
3509
if (options.body !== undefined) {
3510
3510
if (options.mediaType?.includes('/json')) {
3511
3511
return JSON.stringify(options.body)
@@ -3545,7 +3545,7 @@ export const sendRequest = async (
3545
3545
return await fetch(url, request);
3546
3546
};
3547
3547
3548
- const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {
3548
+ export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => {
3549
3549
if (responseHeader) {
3550
3550
const content = response.headers.get(responseHeader);
3551
3551
if (isString(content)) {
@@ -3555,7 +3555,7 @@ const getResponseHeader = (response: Response, responseHeader?: string): string
3555
3555
return undefined;
3556
3556
};
3557
3557
3558
- const getResponseBody = async (response: Response): Promise<any> => {
3558
+ export const getResponseBody = async (response: Response): Promise<any> => {
3559
3559
if (response.status !== 204) {
3560
3560
try {
3561
3561
const contentType = response.headers.get('Content-Type');
@@ -3575,7 +3575,7 @@ const getResponseBody = async (response: Response): Promise<any> => {
3575
3575
return undefined;
3576
3576
};
3577
3577
3578
- const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
3578
+ export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => {
3579
3579
const errors: Record<number, string> = {
3580
3580
400: 'Bad Request',
3581
3581
401: 'Unauthorized',
@@ -3711,6 +3711,7 @@ export type { Pageable } from './models/Pageable';
3711
3711
export type { SimpleBoolean } from './models/SimpleBoolean';
3712
3712
export type { SimpleFile } from './models/SimpleFile';
3713
3713
export type { SimpleInteger } from './models/SimpleInteger';
3714
+ export type { SimpleParameter } from './models/SimpleParameter';
3714
3715
export type { SimpleReference } from './models/SimpleReference';
3715
3716
export type { SimpleString } from './models/SimpleString';
3716
3717
export type { SimpleStringWithPattern } from './models/SimpleStringWithPattern';
@@ -3780,6 +3781,7 @@ export { $Pageable } from './schemas/$Pageable';
3780
3781
export { $SimpleBoolean } from './schemas/$SimpleBoolean';
3781
3782
export { $SimpleFile } from './schemas/$SimpleFile';
3782
3783
export { $SimpleInteger } from './schemas/$SimpleInteger';
3784
+ export { $SimpleParameter } from './schemas/$SimpleParameter';
3783
3785
export { $SimpleReference } from './schemas/$SimpleReference';
3784
3786
export { $SimpleString } from './schemas/$SimpleString';
3785
3787
export { $SimpleStringWithPattern } from './schemas/$SimpleStringWithPattern';
@@ -4907,6 +4909,19 @@ export type SimpleInteger = number;
4907
4909
"
4908
4910
`;
4909
4911
4912
+ exports[`v3 should generate: test/generated/v3/models/SimpleParameter.ts 1`] = `
4913
+ "/* istanbul ignore file */
4914
+ /* tslint:disable */
4915
+ /* eslint-disable */
4916
+
4917
+ /**
4918
+ * This is a reusable parameter
4919
+ */
4920
+ export type SimpleParameter = string;
4921
+ "
4922
+ `;
4923
+
4924
+ exports[`v3 should generate: test/generated/v3/models/SimpleReference.ts 1`] = `
4910
4925
"/* istanbul ignore file */
4911
4926
/* tslint:disable */
4912
4927
/* eslint-disable */
@@ -6234,6 +6249,17 @@ export const $SimpleInteger = {
6234
6249
"
6235
6250
`;
6236
6251
6252
+ exports[`v3 should generate: test/generated/v3/schemas/$SimpleParameter.ts 1`] = `
6253
+ "/* istanbul ignore file */
6254
+ /* tslint:disable */
6255
+ /* eslint-disable */
6256
+ export const $SimpleParameter = {
6257
+ type: 'string',
6258
+ description: \`This is a reusable parameter\`,
6259
+ } as const;
6260
+ "
6261
+ `;
6262
+
6237
6263
exports[`v3 should generate: test/generated/v3/schemas/$SimpleReference.ts 1`] = `
6238
6264
"/* istanbul ignore file */
6239
6265
/* tslint:disable */
0 commit comments