swagger-api / swagger-api/swagger-codegen

licenseUrl for "generate -l java" has no effect

Open
#11,951 0 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

Description

java -jar swagger-codegen-cli-3.0.35.jar config-help -l java
would suggest one can set the lisenceUrl

Swagger-codegen version

swagger-codegen-cli-3.0.35

Steps to reproduce
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.35/swagger-codegen-cli-3.0.35.jar -O swagger-codegen-cli-3.0.35.jar

cat << EOF > swagger-codegen-config.json
{
  "licenseName": "GPL-v2.0",
  "licenseUrl": "https://choosealicense.com/licenses/gpl-2.0/",
  "java8": "true",
  "useGzipFeature": "true"
}
EOF

rm -rf tmp

java -jar swagger-codegen-cli-3.0.35.jar generate \
   -i https://petstore.swagger.io/v2/swagger.json \
   -l java \
   -DlicenseName="GPL-v2.0", \
   -DlicenseUrl="https://choosealicense.com/licenses/gpl-2.0/" \
   -c swagger-codegen-config.json \
   -o tmp
   
grep -m 1 -A 5 "<license>" tmp/pom.xml

yields:

 <license>
      <name>GPL-v2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

the URL is incorrect and not was specified via command-line or the config.

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 with the Java generator's handling of licenseName and licenseUrl, then trace how those values reach the generated pom.xml. Reproduce the issue with swagger-codegen-cli 3.0.35 using the command and configuration shown; done means the generated pom.xml contains the configured license URL instead of the Apache default.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.