-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorval.config.ts
58 lines (57 loc) · 1.44 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
import { faker } from '@faker-js/faker'
import { defineConfig } from 'orval'
export default defineConfig({
petstore: {
output: {
baseUrl: '/api/v3',
target: 'src/service/petstore/endpoint.ts',
schemas: 'src/service/petstore/model',
mock: true,
mode: 'split',
prettier: true,
override: {
mutator: {
path: 'src/service/axios/index.ts',
name: 'createRequest',
},
operations: {
listPets: {
mock: {
properties: () => {
return {
'[].id': () => faker.number.int({ min: 1, max: 99999 }),
}
},
},
},
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: 'https://petstore3.swagger.io/api/v3/openapi.json',
override: {
// transformer: 'src/service/transformer/add-version.js',
},
},
hooks: {
afterAllFilesWrite: ['eslint --fix'],
},
},
})