forked from orval-labs/orval
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorval.config.ts
60 lines (59 loc) · 1.54 KB
/
orval.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { faker } from '@faker-js/faker';
import { defineConfig } from 'orval';
export default defineConfig({
petstore: {
output: {
mode: 'split',
target: 'src/api/endpoints/petstoreFromFileSpecWithTransformer.ts',
schemas: 'src/api/model',
client: 'react-query',
mock: true,
prettier: true,
override: {
mutator: {
path: './src/api/mutator/custom-instance.ts',
name: 'customInstance',
},
operations: {
listPets: {
mock: {
properties: () => ({
'[].id': () => faker.number.int({ min: 1, max: 99999 }),
}),
},
query: {
useQuery: true,
useSuspenseQuery: true,
useSuspenseInfiniteQuery: true,
useInfinite: true,
useInfiniteQueryParam: 'limit',
},
},
showPetById: {
mock: {
data: () => ({
id: faker.number.int({ min: 1, max: 99 }),
name: faker.person.firstName(),
tag: faker.helpers.arrayElement([
faker.word.sample(),
undefined,
]),
}),
},
},
},
mock: {
properties: {
'/tag|name/': () => faker.person.lastName(),
},
},
},
},
input: {
target: './petstore.yaml',
override: {
transformer: './src/api/transformer/add-version.js',
},
},
},
});