Open svrooij opened 9 months ago
Great idea! We could go about it in two ways:
Thoughts?
I'm all for having it done automatically. So you point it to an OpenAPI spec and it should start getting those requests. And if you say "here is my open AI key, please generate mocks for all endpoints". It should do that once. maybe even hash the spec of a single action? That would allow caching the mock on a per request base, which is probably cheaper than regenerating mocks for all requests if only a single request in the openapi spec has changed.
Maybe even do the generating of the mocks on the fly (with a 429 to delay the client 😉) so only request that are tested get (expensive) mocks, and not every request in the spec.
It would be very cool if you could point the dev proxy to some openapi spec url and have it mock that api.
And as an extra feature it should use AI (bring your own key) that checks the object type and tries to mock reasonable data.
So if you mock a
/users/{id}
endpoint it would generate a reasonable response for agivenName
or amail
property.The generated response should be saved for economic reasons off course.