swagger-api / swagger-api/swagger-codegen

Add JAVA_OPTS to swagger-generator scripts

Open
#10,139 7 comments 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

We would like to pass some options to the java executor to reduce logging output:

export JAVA_OPTS="${JAVA_OPTS} -Dlog.level=warn --illegal-access=warn"

In the OpenApi generator for example this is done by setting JAVA_OPTS and then calling the script:

> cat $(which openapi-generator)
#!/bin/bash
exec "/usr/local/opt/openjdk/bin/java" $JAVA_OPTS -jar "/usr/local/Cellar/openapi-generator/4.2.3_1/libexec/openapi-generator-cli.jar" "$@"

In swagger-codegen those JAVA_OPTS are ignored:

> cat $(which swagger-codegen)
#!/bin/bash
exec java -jar /usr/local/Cellar/swagger-codegen/3.0.18/libexec/swagger-codegen-cli.jar "$@"

Seems to work when I modify the script and add the options:

/> cat $(which swagger-codegen)
#!/bin/bash
exec java $JAVA_OPTS -jar /usr/local/Cellar/swagger-codegen/3.0.18/libexec/swagger-codegen-cli.jar "$@"

macOS, homebrew, swagger-codegen version 3.0.18

I don't see any discussion about the issue, would it be okay to just add the parameter?

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 by locating the swagger-codegen launcher script or packaging entry point that produces the wrapper shown in the issue, then compare it with the openapi-generator wrapper. Verify that the resulting command passes JAVA_OPTS before the JAR and that existing command-line arguments still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.