OpenAPITools / OpenAPITools/openapi-generator
[REQ] Add Ability To Creat Mock APIs For Generated Servers
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
When doing development of APIs and clients, it is often useful to be able to create Mock API endpoints for testing/validation before putting in lots of effort to implement a real API. This enhancement would allow a generated server to return Mock data based on extension information in the OpenAPI Specification
Describe the solution you'd like
One example would be to use a library like DataFaker or Faker.js in the generated server code to return Mock data based on an x-mock-data attribute on fields in the API Spec.
Describe alternatives you've considered
I have often used Prism and FakeIt to do this, but it would be AWESOME if we could have most server generators integrate this as an option so that you get Mock results until the endpoint is actually implemented.
Additional context
See this article about using DataFaker
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or generator entry points. Start by surveying the generated-server architecture and how OpenAPI extensions are handled; the request would be done when a defined set of server generators can return mock data from an x-mock-data specification extension.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- api, backend-api-design, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100