1 const { faker } = require('@faker-js/faker');
2
3 module.exports = {
4 petstore: {
5 output: {
6 mode: 'split',
7 target: 'src/petstore.ts',
8 schemas: 'src/model',
9 client: 'react-query',
10 mock: true,
11 override: {
12 operations: {
13 listPets: {
14 mutator: 'src/response-type.js',
15 mock: {
16 properties: () => {
17 return {
18 id: () => faker.number.int({ min: 1, max: 99999 }),
19 };
20 },
21 },
22 },
23 showPetById: {
24 mock: {
25 data: () => ({
26 id: faker.number.int({ min: 1, max: 99 }),
27 name: faker.person.firstName(),
28 tag: faker.helpers.arrayElement([
29 faker.word.sample(),
30 undefined,
31 ]),
32 }),
33 },
34 },
35 },
36 mock: {
37 properties: {
38 '/tag|name/': () => faker.person.lastName(),
39 },
40 delay: 500,
41 },
42 },
43 allParamsOptional: true,
44 urlEncodeParameters: true,
45 },
46 input: {
47 target: './petstore.yaml',
48 override: {
49 transformer: 'src/add-version.js',
50 },
51 },
52 hooks: {
53 afterAllFilesWrite: 'prettier --write',
54 },
55 },
56 };