OpenAPITools / OpenAPITools/openapi-generator
[REQ] Allow for the CLI to watch for spec file changes, and generate on demand
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.
Currently, I run a project in which model/controller classes are monitored in real time, and the spec.json is updated automatically as any changes are made. The desire is to marry this with front-end development, and allow for dynamic updating of API clients. This aims to provide a seamless integration between making model changes in the API, and having the API client reflect those changes near instantly.
Describe the solution you'd like
What I'm proposing is to add a watch flag, (-w, --watch) to the cli. When in watch mode, the cli will generate the code on initial startup, and will remain running listening for changes to the spec file. When any changes are detected, the code generation will execute again, producing the updated client output.
Describe alternatives you've considered
I've toyed with this in a few manners, but generally the latency is high with having to restart the cli (and JVM) on every execution.
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 or tests. Start at the Java CLI entry point and the existing spec-to-client generation flow, then trace option parsing and lifecycle behavior. Done means -w/--watch performs an initial generation, remains running, and regenerates after spec.json changes; add or locate coverage for those behaviors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100