@kubb/plugin-faker 4.29.1 → 4.31.1
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/package.json +8 -7
- package/dist/types-DpNAdZTi.d.ts +0 -133
- package/src/generators/__snapshots__/createPet.ts +0 -30
- package/src/generators/__snapshots__/createPetSeed.ts +0 -34
- package/src/generators/__snapshots__/createPetUnknownTypeAny.ts +0 -30
- package/src/generators/__snapshots__/deletePet.ts +0 -8
- package/src/generators/__snapshots__/enumNames.ts +0 -9
- package/src/generators/__snapshots__/enumVarNames.ts +0 -9
- package/src/generators/__snapshots__/float.ts +0 -9
- package/src/generators/__snapshots__/getPets.ts +0 -33
- package/src/generators/__snapshots__/integer.ts +0 -9
- package/src/generators/__snapshots__/node.ts +0 -12
- package/src/generators/__snapshots__/pet.ts +0 -20
- package/src/generators/__snapshots__/petAdoption400.ts +0 -8
- package/src/generators/__snapshots__/petAdoptionError.ts +0 -12
- package/src/generators/__snapshots__/petWithDateString.ts +0 -20
- package/src/generators/__snapshots__/petWithDayjs.ts +0 -21
- package/src/generators/__snapshots__/petWithMapper.ts +0 -20
- package/src/generators/__snapshots__/petWithRandExp.ts +0 -21
- package/src/generators/__snapshots__/pets.ts +0 -9
- package/src/generators/__snapshots__/showPetById.ts +0 -30
- package/src/generators/__snapshots__/string.ts +0 -9
- package/src/generators/__snapshots__/treeNode.ts +0 -12
- package/src/generators/__snapshots__/updatePet.ts +0 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-faker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.31.1",
|
|
4
4
|
"description": "Faker.js data generator plugin for Kubb, creating realistic mock data from OpenAPI specifications for development and testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"faker",
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
"src",
|
|
61
61
|
"dist",
|
|
62
62
|
"!/**/**.test.**",
|
|
63
|
-
"!/**/__tests__/**"
|
|
63
|
+
"!/**/__tests__/**",
|
|
64
|
+
"!/**/__snapshots__/**"
|
|
64
65
|
],
|
|
65
66
|
"size-limit": [
|
|
66
67
|
{
|
|
@@ -70,11 +71,11 @@
|
|
|
70
71
|
}
|
|
71
72
|
],
|
|
72
73
|
"dependencies": {
|
|
73
|
-
"@kubb/react-fabric": "0.13.
|
|
74
|
-
"@kubb/core": "4.
|
|
75
|
-
"@kubb/oas": "4.
|
|
76
|
-
"@kubb/plugin-oas": "4.
|
|
77
|
-
"@kubb/plugin-ts": "4.
|
|
74
|
+
"@kubb/react-fabric": "0.13.3",
|
|
75
|
+
"@kubb/core": "4.31.1",
|
|
76
|
+
"@kubb/oas": "4.31.1",
|
|
77
|
+
"@kubb/plugin-oas": "4.31.1",
|
|
78
|
+
"@kubb/plugin-ts": "4.31.1"
|
|
78
79
|
},
|
|
79
80
|
"engines": {
|
|
80
81
|
"node": ">=20"
|
package/dist/types-DpNAdZTi.d.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Exclude, Include, Override, ResolvePathOptions, Schema } from "@kubb/plugin-oas";
|
|
2
|
-
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
3
|
-
import { Oas, SchemaObject, contentType } from "@kubb/oas";
|
|
4
|
-
import { Generator } from "@kubb/plugin-oas/generators";
|
|
5
|
-
|
|
6
|
-
//#region \0rolldown/runtime.js
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/types.d.ts
|
|
9
|
-
type Options = {
|
|
10
|
-
/**
|
|
11
|
-
* Specify the export location for the files and define the behavior of the output
|
|
12
|
-
* @default { path: 'handlers', barrelType: 'named' }
|
|
13
|
-
*/
|
|
14
|
-
output?: Output<Oas>;
|
|
15
|
-
/**
|
|
16
|
-
* Define which contentType should be used.
|
|
17
|
-
* By default, the first JSON valid mediaType is used
|
|
18
|
-
*/
|
|
19
|
-
contentType?: contentType;
|
|
20
|
-
/**
|
|
21
|
-
* Group the Faker mocks based on the provided name.
|
|
22
|
-
*/
|
|
23
|
-
group?: Group;
|
|
24
|
-
/**
|
|
25
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
26
|
-
*/
|
|
27
|
-
exclude?: Array<Exclude>;
|
|
28
|
-
/**
|
|
29
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
30
|
-
*/
|
|
31
|
-
include?: Array<Include>;
|
|
32
|
-
/**
|
|
33
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
34
|
-
*/
|
|
35
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
36
|
-
/**
|
|
37
|
-
* Choose to use date or datetime as JavaScript Date instead of string.
|
|
38
|
-
* - 'string' represents dates as string values.
|
|
39
|
-
* - 'date' represents dates as JavaScript Date objects.
|
|
40
|
-
* @default 'string'
|
|
41
|
-
*/
|
|
42
|
-
dateType?: 'string' | 'date';
|
|
43
|
-
/**
|
|
44
|
-
* Choose to use `number` or `bigint` for integer fields with `int64` format.
|
|
45
|
-
* - 'number' uses the JavaScript `number` type (matches JSON.parse() runtime behavior).
|
|
46
|
-
* - 'bigint' uses the JavaScript `bigint` type (accurate for values exceeding Number.MAX_SAFE_INTEGER).
|
|
47
|
-
* @note in v5 of Kubb 'bigint' will become the default to better align with OpenAPI's int64 specification.
|
|
48
|
-
* @default 'number'
|
|
49
|
-
*/
|
|
50
|
-
integerType?: 'number' | 'bigint';
|
|
51
|
-
/**
|
|
52
|
-
* Which parser should be used when dateType is set to string.
|
|
53
|
-
* - 'faker' uses faker's built-in date formatting methods.
|
|
54
|
-
* - 'dayjs' uses dayjs for date formatting with custom patterns.
|
|
55
|
-
* - 'moment' uses moment for date formatting with custom patterns.
|
|
56
|
-
* @default 'faker'
|
|
57
|
-
*/
|
|
58
|
-
dateParser?: 'faker' | 'dayjs' | 'moment' | (string & {});
|
|
59
|
-
/**
|
|
60
|
-
* Which type to use when the Swagger/OpenAPI file is not providing more information.
|
|
61
|
-
* - 'any' allows any value.
|
|
62
|
-
* - 'unknown' requires type narrowing before use.
|
|
63
|
-
* - 'void' represents no value.
|
|
64
|
-
* @default 'any'
|
|
65
|
-
*/
|
|
66
|
-
unknownType?: 'any' | 'unknown' | 'void';
|
|
67
|
-
/**
|
|
68
|
-
* Which type to use for empty schema values.
|
|
69
|
-
* - 'any' allows any value.
|
|
70
|
-
* - 'unknown' requires type narrowing before use.
|
|
71
|
-
* - 'void' represents no value.
|
|
72
|
-
* @default `unknownType`
|
|
73
|
-
*/
|
|
74
|
-
emptySchemaType?: 'any' | 'unknown' | 'void';
|
|
75
|
-
/**
|
|
76
|
-
* Choose which generator to use when using Regexp.
|
|
77
|
-
* - 'faker' uses faker.helpers.fromRegExp for generating values from regex patterns.
|
|
78
|
-
* - 'randexp' uses RandExp library for generating values from regex patterns.
|
|
79
|
-
* @default 'faker'
|
|
80
|
-
*/
|
|
81
|
-
regexGenerator?: 'faker' | 'randexp';
|
|
82
|
-
mapper?: Record<string, string>;
|
|
83
|
-
/**
|
|
84
|
-
* The use of Seed is intended to allow for consistent values in a test.
|
|
85
|
-
*/
|
|
86
|
-
seed?: number | number[];
|
|
87
|
-
/**
|
|
88
|
-
* Transform parameter names to a specific casing format.
|
|
89
|
-
* When set to 'camelcase', parameter names in path, query, and header params will be transformed to camelCase.
|
|
90
|
-
* This should match the paramsCasing setting used in @kubb/plugin-ts.
|
|
91
|
-
* @default undefined
|
|
92
|
-
*/
|
|
93
|
-
paramsCasing?: 'camelcase';
|
|
94
|
-
transformers?: {
|
|
95
|
-
/**
|
|
96
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
97
|
-
*/
|
|
98
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
99
|
-
/**
|
|
100
|
-
* Receive schema and baseName(propertyName) and return FakerMeta array
|
|
101
|
-
* TODO TODO add docs
|
|
102
|
-
* @beta
|
|
103
|
-
*/
|
|
104
|
-
schema?: (props: {
|
|
105
|
-
schema: SchemaObject | null;
|
|
106
|
-
name: string | null;
|
|
107
|
-
parentName: string | null;
|
|
108
|
-
}, defaultSchemas: Schema[]) => Schema[] | undefined;
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* Define some generators next to the faker generators
|
|
112
|
-
*/
|
|
113
|
-
generators?: Array<Generator<PluginFaker>>;
|
|
114
|
-
};
|
|
115
|
-
type ResolvedOptions = {
|
|
116
|
-
output: Output<Oas>;
|
|
117
|
-
group: Options['group'];
|
|
118
|
-
override: NonNullable<Options['override']>;
|
|
119
|
-
dateType: NonNullable<Options['dateType']>;
|
|
120
|
-
integerType: NonNullable<Options['integerType']>;
|
|
121
|
-
dateParser: NonNullable<Options['dateParser']>;
|
|
122
|
-
unknownType: NonNullable<Options['unknownType']>;
|
|
123
|
-
emptySchemaType: NonNullable<Options['emptySchemaType']>;
|
|
124
|
-
transformers: NonNullable<Options['transformers']>;
|
|
125
|
-
seed: NonNullable<Options['seed']> | undefined;
|
|
126
|
-
mapper: NonNullable<Options['mapper']>;
|
|
127
|
-
regexGenerator: NonNullable<Options['regexGenerator']>;
|
|
128
|
-
paramsCasing: Options['paramsCasing'];
|
|
129
|
-
};
|
|
130
|
-
type PluginFaker = PluginFactoryOptions<'plugin-faker', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
131
|
-
//#endregion
|
|
132
|
-
export { PluginFaker as n, __name as r, Options as t };
|
|
133
|
-
//# sourceMappingURL=types-DpNAdZTi.d.ts.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @description Null response
|
|
9
|
-
*/
|
|
10
|
-
export function createPets201() {
|
|
11
|
-
return undefined
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @description unexpected error
|
|
16
|
-
*/
|
|
17
|
-
export function createPetsError(data?: Partial<CreatePetsError>): CreatePetsError {
|
|
18
|
-
return error(data)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function createPetsMutationRequest(data?: Partial<CreatePetsMutationRequest>): CreatePetsMutationRequest {
|
|
22
|
-
return {
|
|
23
|
-
...{ name: faker.string.alpha(), tag: faker.string.alpha() },
|
|
24
|
-
...(data || {}),
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function createPetsMutationResponse(data?: Partial<CreatePetsMutationResponse>): CreatePetsMutationResponse {
|
|
29
|
-
return data || faker.helpers.arrayElement<any>([createPets201()])
|
|
30
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @description Null response
|
|
9
|
-
*/
|
|
10
|
-
export function createPets201() {
|
|
11
|
-
faker.seed([222])
|
|
12
|
-
return undefined
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @description unexpected error
|
|
17
|
-
*/
|
|
18
|
-
export function createPetsError(data?: Partial<CreatePetsError>): CreatePetsError {
|
|
19
|
-
faker.seed([222])
|
|
20
|
-
return error(data)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function createPetsMutationRequest(data?: Partial<CreatePetsMutationRequest>): CreatePetsMutationRequest {
|
|
24
|
-
faker.seed([222])
|
|
25
|
-
return {
|
|
26
|
-
...{ name: faker.string.alpha(), tag: faker.string.alpha() },
|
|
27
|
-
...(data || {}),
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function createPetsMutationResponse(data?: Partial<CreatePetsMutationResponse>): CreatePetsMutationResponse {
|
|
32
|
-
faker.seed([222])
|
|
33
|
-
return data || faker.helpers.arrayElement<any>([createPets201()])
|
|
34
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @description Null response
|
|
9
|
-
*/
|
|
10
|
-
export function createPets201() {
|
|
11
|
-
return undefined
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @description unexpected error
|
|
16
|
-
*/
|
|
17
|
-
export function createPetsError(data?: Partial<CreatePetsError>): CreatePetsError {
|
|
18
|
-
return error(data)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function createPetsMutationRequest(data?: Partial<CreatePetsMutationRequest>): CreatePetsMutationRequest {
|
|
22
|
-
return {
|
|
23
|
-
...{ name: faker.string.alpha(), tag: faker.string.alpha() },
|
|
24
|
-
...(data || {}),
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function createPetsMutationResponse(data?: Partial<CreatePetsMutationResponse>): CreatePetsMutationResponse {
|
|
29
|
-
return data || faker.helpers.arrayElement<any>([createPets201()])
|
|
30
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function enumNamesType(data?: Partial<EnumNamesType>): EnumNamesType {
|
|
8
|
-
return data || faker.helpers.arrayElement<EnumNamesType>([0, 1])
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function enumVarNamesType(data?: Partial<EnumVarNamesType>): EnumVarNamesType {
|
|
8
|
-
return data || faker.helpers.arrayElement<EnumVarNamesType>([0, 1])
|
|
9
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function listPetsQueryParams(data?: Partial<ListPetsQueryParams>): ListPetsQueryParams {
|
|
8
|
-
return {
|
|
9
|
-
...{ limit: faker.string.alpha() },
|
|
10
|
-
...(data || {}),
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @description A paged array of pets
|
|
16
|
-
*/
|
|
17
|
-
export function listPets200(data?: Partial<ListPets200>): ListPets200 {
|
|
18
|
-
return {
|
|
19
|
-
...{ ...pagination(), ...pets() },
|
|
20
|
-
...(data || {}),
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @description unexpected error
|
|
26
|
-
*/
|
|
27
|
-
export function listPetsError(data?: Partial<ListPetsError>): ListPetsError {
|
|
28
|
-
return error(data)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function listPetsQueryResponse(data?: Partial<ListPetsQueryResponse>): ListPetsQueryResponse {
|
|
32
|
-
return data || faker.helpers.arrayElement<any>([listPets200()])
|
|
33
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function node(data?: Partial<Node>): Node {
|
|
8
|
-
return {
|
|
9
|
-
...{ id: faker.string.alpha(), children: faker.helpers.multiple(() => undefined as any) },
|
|
10
|
-
...(data || {}),
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function pet(data?: Partial<Pet>): Pet {
|
|
8
|
-
return {
|
|
9
|
-
...{
|
|
10
|
-
id: faker.number.int(),
|
|
11
|
-
name: faker.string.alpha(),
|
|
12
|
-
tag: faker.string.alpha(),
|
|
13
|
-
code: faker.helpers.fromRegExp('\b[1-9]\b'),
|
|
14
|
-
shipDate: faker.date.anytime(),
|
|
15
|
-
shipTime: faker.date.anytime(),
|
|
16
|
-
info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
|
|
17
|
-
},
|
|
18
|
-
...(data || {}),
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @description Pet adoption error codes
|
|
9
|
-
*/
|
|
10
|
-
export function petAdoptionError(data?: Partial<PetAdoptionError>): PetAdoptionError {
|
|
11
|
-
return data || faker.helpers.arrayElement<PetAdoptionError>(['pet_not_found', 'already_adopted', 'age_restriction'])
|
|
12
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function pet(data?: Partial<Pet>): Pet {
|
|
8
|
-
return {
|
|
9
|
-
...{
|
|
10
|
-
id: faker.number.int(),
|
|
11
|
-
name: faker.string.alpha(),
|
|
12
|
-
tag: faker.string.alpha(),
|
|
13
|
-
code: faker.helpers.fromRegExp('\b[1-9]\b'),
|
|
14
|
-
shipDate: faker.date.anytime().toISOString().substring(0, 10),
|
|
15
|
-
shipTime: faker.date.anytime().toISOString().substring(11, 19),
|
|
16
|
-
info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
|
|
17
|
-
},
|
|
18
|
-
...(data || {}),
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import dayjs from 'dayjs'
|
|
6
|
-
import { faker } from '@faker-js/faker'
|
|
7
|
-
|
|
8
|
-
export function pet(data?: Partial<Pet>): Pet {
|
|
9
|
-
return {
|
|
10
|
-
...{
|
|
11
|
-
id: faker.number.int(),
|
|
12
|
-
name: faker.string.alpha(),
|
|
13
|
-
tag: faker.string.alpha(),
|
|
14
|
-
code: faker.helpers.fromRegExp('\b[1-9]\b'),
|
|
15
|
-
shipDate: dayjs(faker.date.anytime()).format('YYYY-MM-DD'),
|
|
16
|
-
shipTime: dayjs(faker.date.anytime()).format('HH:mm:ss'),
|
|
17
|
-
info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
|
|
18
|
-
},
|
|
19
|
-
...(data || {}),
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function pet(data?: Partial<Pet>): Pet {
|
|
8
|
-
return {
|
|
9
|
-
...{
|
|
10
|
-
id: faker.string.fromCharacters('abc'),
|
|
11
|
-
name: faker.string.alpha({ casing: 'lower' }),
|
|
12
|
-
tag: faker.string.alpha(),
|
|
13
|
-
code: faker.helpers.fromRegExp('\b[1-9]\b'),
|
|
14
|
-
shipDate: faker.date.anytime(),
|
|
15
|
-
shipTime: faker.date.anytime(),
|
|
16
|
-
info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
|
|
17
|
-
},
|
|
18
|
-
...(data || {}),
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import RandExp from 'randexp'
|
|
6
|
-
import { faker } from '@faker-js/faker'
|
|
7
|
-
|
|
8
|
-
export function pet(data?: Partial<Pet>): Pet {
|
|
9
|
-
return {
|
|
10
|
-
...{
|
|
11
|
-
id: faker.number.int(),
|
|
12
|
-
name: faker.string.alpha(),
|
|
13
|
-
tag: faker.string.alpha(),
|
|
14
|
-
code: new RandExp('\\b[1-9]\\b').gen(),
|
|
15
|
-
shipDate: faker.date.anytime(),
|
|
16
|
-
shipTime: faker.date.anytime(),
|
|
17
|
-
info: { animal: faker.helpers.arrayElement<NonNullable<NonNullable<Pet>['info']>['animal']>(['dog', 'cat', 'ant']) },
|
|
18
|
-
},
|
|
19
|
-
...(data || {}),
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function showPetByIdPathParams(data?: Partial<ShowPetByIdPathParams>): ShowPetByIdPathParams {
|
|
8
|
-
return {
|
|
9
|
-
...{ petId: faker.string.alpha(), testId: faker.string.alpha() },
|
|
10
|
-
...(data || {}),
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @description Expected response to a valid request
|
|
16
|
-
*/
|
|
17
|
-
export function showPetById200(data?: Partial<ShowPetById200>): ShowPetById200 {
|
|
18
|
-
return pet(data)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @description unexpected error
|
|
23
|
-
*/
|
|
24
|
-
export function showPetByIdError(data?: Partial<ShowPetByIdError>): ShowPetByIdError {
|
|
25
|
-
return error(data)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function showPetByIdQueryResponse(data?: Partial<ShowPetByIdQueryResponse>): ShowPetByIdQueryResponse {
|
|
29
|
-
return data || faker.helpers.arrayElement<any>([showPetById200()])
|
|
30
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function treeNode(data?: Partial<TreeNode>): TreeNode {
|
|
8
|
-
return {
|
|
9
|
-
...{ value: faker.string.alpha(), left: undefined as any, right: undefined as any },
|
|
10
|
-
...(data || {}),
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import { faker } from '@faker-js/faker'
|
|
6
|
-
|
|
7
|
-
export function updatePetPathParams(data?: Partial<UpdatePetPathParams>): UpdatePetPathParams {
|
|
8
|
-
return {
|
|
9
|
-
...{ petId: faker.number.int() },
|
|
10
|
-
...(data || {}),
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @description Pet updated
|
|
16
|
-
*/
|
|
17
|
-
export function updatePet200(data?: Partial<UpdatePet200>): UpdatePet200 {
|
|
18
|
-
return pet(data)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @description unexpected error
|
|
23
|
-
*/
|
|
24
|
-
export function updatePetError(data?: Partial<UpdatePetError>): UpdatePetError {
|
|
25
|
-
return error(data)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function updatePetMutationRequest(data?: Partial<UpdatePetMutationRequest>): UpdatePetMutationRequest {
|
|
29
|
-
return pet(data)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function updatePetMutationResponse(data?: Partial<UpdatePetMutationResponse>): UpdatePetMutationResponse {
|
|
33
|
-
return data || faker.helpers.arrayElement<any>([updatePet200()])
|
|
34
|
-
}
|