@kubb/plugin-faker 3.1.0 → 3.3.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/package.json +9 -9
- package/src/generators/__snapshots__/createPet.ts +12 -12
- package/src/generators/__snapshots__/createPetSeed.ts +16 -16
- package/src/generators/__snapshots__/createPetUnknownTypeAny.ts +12 -12
- package/src/generators/__snapshots__/deletePet.ts +1 -1
- package/src/generators/__snapshots__/enumNames.ts +3 -3
- package/src/generators/__snapshots__/enumVarNames.ts +3 -3
- package/src/generators/__snapshots__/getPets.ts +12 -12
- package/src/generators/__snapshots__/pet.ts +13 -6
- package/src/generators/__snapshots__/petWithDateString.ts +13 -6
- package/src/generators/__snapshots__/petWithDayjs.ts +14 -7
- package/src/generators/__snapshots__/petWithMapper.ts +13 -6
- package/src/generators/__snapshots__/petWithRandExp.ts +14 -7
- package/src/generators/__snapshots__/pets.ts +3 -6
- package/src/generators/__snapshots__/showPetById.ts +12 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-faker",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Generator plugin-faker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"faker",
|
|
@@ -61,18 +61,18 @@
|
|
|
61
61
|
"!/**/__tests__/**"
|
|
62
62
|
],
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@kubb/core": "3.
|
|
65
|
-
"@kubb/fs": "3.
|
|
66
|
-
"@kubb/oas": "3.
|
|
67
|
-
"@kubb/plugin-oas": "3.
|
|
68
|
-
"@kubb/plugin-ts": "3.
|
|
69
|
-
"@kubb/react": "3.
|
|
64
|
+
"@kubb/core": "3.3.0",
|
|
65
|
+
"@kubb/fs": "3.3.0",
|
|
66
|
+
"@kubb/oas": "3.3.0",
|
|
67
|
+
"@kubb/plugin-oas": "3.3.0",
|
|
68
|
+
"@kubb/plugin-ts": "3.3.0",
|
|
69
|
+
"@kubb/react": "3.3.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"tsup": "^8.3.5",
|
|
73
73
|
"typescript": "^5.7.2",
|
|
74
|
-
"@kubb/config-ts": "3.
|
|
75
|
-
"@kubb/config-tsup": "3.
|
|
74
|
+
"@kubb/config-ts": "3.3.0",
|
|
75
|
+
"@kubb/config-tsup": "3.3.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"@kubb/react": "^3.0.0"
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
4
|
* @description Null response
|
|
5
5
|
*/
|
|
6
6
|
export function createPets201() {
|
|
7
|
-
|
|
7
|
+
return unknown
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
11
|
* @description unexpected error
|
|
12
12
|
*/
|
|
13
13
|
export function createPetsError() {
|
|
14
|
-
|
|
14
|
+
return error()
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
export function createPetsMutationRequest(data?: Partial<CreatePetsMutationRequest>) {
|
|
18
|
+
return {
|
|
19
|
+
...{ name: faker.string.alpha(), tag: faker.string.alpha() },
|
|
20
|
+
...(data || {}),
|
|
21
|
+
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
export function createPetsMutationResponse(data?: Partial<CreatePetsMutationResponse>) {
|
|
25
|
+
return data || faker.helpers.arrayElement<any>([createPets201()])
|
|
26
26
|
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
4
|
* @description Null response
|
|
5
5
|
*/
|
|
6
6
|
export function createPets201() {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
faker.seed([222])
|
|
8
|
+
return unknown
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
12
|
* @description unexpected error
|
|
13
13
|
*/
|
|
14
14
|
export function createPetsError() {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
faker.seed([222])
|
|
16
|
+
return error()
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
export function createPetsMutationRequest(data?: Partial<CreatePetsMutationRequest>) {
|
|
20
|
+
faker.seed([222])
|
|
21
|
+
return {
|
|
22
|
+
...{ name: faker.string.alpha(), tag: faker.string.alpha() },
|
|
23
|
+
...(data || {}),
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export function createPetsMutationResponse(data?: Partial<CreatePetsMutationResponse>) {
|
|
28
|
+
faker.seed([222])
|
|
29
|
+
return data || faker.helpers.arrayElement<any>([createPets201()])
|
|
30
30
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
4
|
* @description Null response
|
|
5
5
|
*/
|
|
6
6
|
export function createPets201() {
|
|
7
|
-
|
|
7
|
+
return undefined
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
11
|
* @description unexpected error
|
|
12
12
|
*/
|
|
13
13
|
export function createPetsError() {
|
|
14
|
-
|
|
14
|
+
return error()
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
export function createPetsMutationRequest(data?: Partial<CreatePetsMutationRequest>) {
|
|
18
|
+
return {
|
|
19
|
+
...{ name: faker.string.alpha(), tag: faker.string.alpha() },
|
|
20
|
+
...(data || {}),
|
|
21
|
+
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
export function createPetsMutationResponse(data?: Partial<CreatePetsMutationResponse>) {
|
|
25
|
+
return data || faker.helpers.arrayElement<any>([createPets201()])
|
|
26
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export function enumNamesType() {
|
|
4
|
+
return faker.helpers.arrayElement<any>(['Pending', 'Received'])
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export function enumVarNamesType() {
|
|
4
|
+
return faker.helpers.arrayElement<any>(['Pending', 'Received'])
|
|
5
5
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export function listPetsQueryParams(data?: Partial<ListPetsQueryParams>) {
|
|
4
|
+
return {
|
|
5
|
+
...{ limit: faker.string.alpha() },
|
|
6
|
+
...(data || {}),
|
|
7
|
+
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
11
|
* @description A paged array of pets
|
|
12
12
|
*/
|
|
13
13
|
export function listPets200() {
|
|
14
|
-
|
|
14
|
+
return pets()
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
18
|
* @description unexpected error
|
|
19
19
|
*/
|
|
20
20
|
export function listPetsError() {
|
|
21
|
-
|
|
21
|
+
return error()
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
export function listPetsQueryResponse(data?: Partial<ListPetsQueryResponse>) {
|
|
25
|
+
return data || faker.helpers.arrayElement<any>([listPets200()])
|
|
26
26
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export function pet(data?: Partial<Pet>) {
|
|
4
|
+
return {
|
|
5
|
+
...{
|
|
6
|
+
id: faker.number.int(),
|
|
7
|
+
name: faker.string.alpha(),
|
|
8
|
+
tag: faker.string.alpha(),
|
|
9
|
+
code: faker.helpers.fromRegExp(new RegExp('\\b[1-9]\\b')),
|
|
10
|
+
shipDate: faker.date.anytime(),
|
|
11
|
+
shipTime: faker.date.anytime(),
|
|
12
|
+
},
|
|
13
|
+
...(data || {}),
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export function pet(data?: Partial<Pet>) {
|
|
4
|
+
return {
|
|
5
|
+
...{
|
|
6
|
+
id: faker.number.int(),
|
|
7
|
+
name: faker.string.alpha(),
|
|
8
|
+
tag: faker.string.alpha(),
|
|
9
|
+
code: faker.helpers.fromRegExp(new RegExp('\\b[1-9]\\b')),
|
|
10
|
+
shipDate: faker.date.anytime().toString(),
|
|
11
|
+
shipTime: faker.date.anytime().toString(),
|
|
12
|
+
},
|
|
13
|
+
...(data || {}),
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import dayjs from
|
|
2
|
-
import { faker } from
|
|
1
|
+
import dayjs from 'dayjs'
|
|
2
|
+
import { faker } from '@faker-js/faker'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export function pet(data?: Partial<Pet>) {
|
|
5
|
+
return {
|
|
6
|
+
...{
|
|
7
|
+
id: faker.number.int(),
|
|
8
|
+
name: faker.string.alpha(),
|
|
9
|
+
tag: faker.string.alpha(),
|
|
10
|
+
code: faker.helpers.fromRegExp(new RegExp('\\b[1-9]\\b')),
|
|
11
|
+
shipDate: dayjs(faker.date.anytime()).format('YYYY-MM-DD'),
|
|
12
|
+
shipTime: dayjs(faker.date.anytime()).format('HH:mm:ss'),
|
|
13
|
+
},
|
|
14
|
+
...(data || {}),
|
|
15
|
+
}
|
|
9
16
|
}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export function pet(data?: Partial<Pet>) {
|
|
4
|
+
return {
|
|
5
|
+
...{
|
|
6
|
+
id: faker.string.fromCharacters('abc'),
|
|
7
|
+
name: faker.string.alpha({ casing: 'lower' }),
|
|
8
|
+
tag: faker.string.alpha(),
|
|
9
|
+
code: faker.helpers.fromRegExp(new RegExp('\\b[1-9]\\b')),
|
|
10
|
+
shipDate: faker.date.anytime(),
|
|
11
|
+
shipTime: faker.date.anytime(),
|
|
12
|
+
},
|
|
13
|
+
...(data || {}),
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import RandExp from
|
|
2
|
-
import { faker } from
|
|
1
|
+
import RandExp from 'randexp'
|
|
2
|
+
import { faker } from '@faker-js/faker'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export function pet(data?: Partial<Pet>) {
|
|
5
|
+
return {
|
|
6
|
+
...{
|
|
7
|
+
id: faker.number.int(),
|
|
8
|
+
name: faker.string.alpha(),
|
|
9
|
+
tag: faker.string.alpha(),
|
|
10
|
+
code: new RandExp('\\b[1-9]\\b').gen(),
|
|
11
|
+
shipDate: faker.date.anytime(),
|
|
12
|
+
shipTime: faker.date.anytime(),
|
|
13
|
+
},
|
|
14
|
+
...(data || {}),
|
|
15
|
+
}
|
|
9
16
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
...faker.helpers.multiple(() => (pet())) as any,
|
|
6
|
-
...data || []
|
|
7
|
-
];
|
|
3
|
+
export function pets(data?: Partial<Pets>) {
|
|
4
|
+
return [...(faker.helpers.multiple(() => pet()) as any), ...(data || [])]
|
|
8
5
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { faker } from
|
|
1
|
+
import { faker } from '@faker-js/faker'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export function showPetByIdPathParams(data?: Partial<ShowPetByIdPathParams>) {
|
|
4
|
+
return {
|
|
5
|
+
...{ petId: faker.string.alpha(), testId: faker.string.alpha() },
|
|
6
|
+
...(data || {}),
|
|
7
|
+
}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
11
|
* @description Expected response to a valid request
|
|
12
12
|
*/
|
|
13
13
|
export function showPetById200() {
|
|
14
|
-
|
|
14
|
+
return pet()
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
18
|
* @description unexpected error
|
|
19
19
|
*/
|
|
20
20
|
export function showPetByIdError() {
|
|
21
|
-
|
|
21
|
+
return error()
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
export function showPetByIdQueryResponse(data?: Partial<ShowPetByIdQueryResponse>) {
|
|
25
|
+
return data || faker.helpers.arrayElement<any>([showPetById200()])
|
|
26
26
|
}
|