OpenAPITools / OpenAPITools/openapi-generator
[REQ] New generator to produce Wiremock Mappings files from input API Spec
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 using Wiremock to stub dependencies, we often have to do the repetitive task of declaring stub endpoints, values, etc. This makes sense when those stubs will be used in a specific test or scenario that requires explicit expectations to be setup.
In some scenarios, we simply want to run a service locally and point to wiremock stubs, without the need to declare specific values, as long as the dependency's API specification is still met.
Describe the solution you'd like
it would be nice to be able to add a new generator to the OpenAPI generator that allows a user to specify a dependency's API specification and generate a set of mapping configuration files. These files can be passed into Wiremock so that stub servers can be setup that match the API spec provided and dummy responses can be generated that comply with the schema specified in the spec.
Describe alternatives you've considered
The Wiremock Cloud offering appears to provide this functionality, but it's not free and requires it be done via their cloud service.
It would be nice to provide this functionality locally so that generation can happen without the need to be connected to the internet.
This project already has kotlin-wiremock and java-wiremock generators which generate code that is used to setup the wiremock stubs; this feature would be an extension of that capability, which would allow users to setup the stubs via config files instead of programmatically.
I've considered using these generators, but would prefer a language agnostic solution. Since the config files are written in JSON, this would make such a generator more generically useful.
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
Review docs/generators/kotlin-wiremock.md and docs/generators/java-wiremock.md to understand the existing WireMock generator capability and conventions. Then trace the generator entry points and determine how an OpenAPI spec should produce local WireMock mapping JSON with schema-compliant dummy responses; done means the generated mappings can be passed to WireMock without programmatic setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100