Open rodriguezc opened 5 years ago
I implemented a controller that send mocks response using json-schema-faker v0.4.7. myController.js
const jsf = require('json-schema-faker'); jsf.option({ optionalsProbabilty: 0.5 }); const jsonSchema = require("exegesis/lib/utils/jsonSchema"); exports.getPartenaireById = function getPartenaireById(context) { const path = `${context.api.operationPtr}/responses/200/content/application~1json/schema`; let schema = jsonSchema.extractSchema(context.api.openApiDoc, path); const mock = jsf(schema); return mock; }
Perhaps you have a good solution to make it generic and integrate it in the core or in a plugin?
Thanks
Oh, very slick! It would be very cool to have this as a plugin.
I implemented a controller that send mocks response using json-schema-faker v0.4.7. myController.js
Perhaps you have a good solution to make it generic and integrate it in the core or in a plugin?
Thanks