swagger-api / swagger-api/swagger-codegen
Add option for SwaggerCodegen to wait for thread
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Similar to https://github.com/swagger-api/swagger-parser/issues/1515, we want to be able to call SwaggerCodegen.main programmatically.
It's easy enough to compile against the main and pass in a String[] args, but because SwaggerCodegen spins up a thread that it doesn't wait for, the call returns before the code is generated, and we have downstream post-processing that expects the code to be there.
We considered just busy-waiting in our calling code, but that was hacky, so we were forced to fork SwaggerCodegen and add a thread join, plus an InterruptedException catch at the outermost scope.
We'd very much like to be able to pass in an option that would cause SwaggerCodegen to join the thread, so we don't need to fork it anymore.
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
Start at the SwaggerCodegen.main entry point and trace the thread that performs code generation. Define how the requested option should control waiting and interruption, then verify that programmatic callers see generated files before main returns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100