swagger-api / swagger-api/swagger-codegen

Add option for SwaggerCodegen to wait for thread

Open
#10,853 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.