2024-05-29 14:40:20 +00:00
|
|
|
import { JSONSchemaFaker } from "json-schema-faker";
|
|
|
|
import { schema } from "./api/index";
|
2024-06-08 13:24:13 +00:00
|
|
|
import { OperationNames } from "./src/api";
|
2024-05-29 14:40:20 +00:00
|
|
|
|
|
|
|
const faker = JSONSchemaFaker;
|
|
|
|
|
|
|
|
faker.option({
|
|
|
|
alwaysFakeOptionals: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
const getFakeResponse = (method: OperationNames, data: any) => {
|
|
|
|
const fakeData = faker.generate(schema.properties[method].properties.return);
|
|
|
|
return fakeData;
|
|
|
|
};
|
|
|
|
|
|
|
|
export { getFakeResponse };
|