swagger-api / swagger-api/swagger-codegen
Selective Generation doesn't work properly when option is appended
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Using version 2.1.6
Commands
java -Dmodels -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ -i http://petstore.swagger.io/v2/swagger.json \ -l java \ -o samples/client/petstore/java
And
java -Dmodels=User,Pet -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ -i http://petstore.swagger.io/v2/swagger.json \ -l java \ -o samples/client/petstore/java
work according to the documentation i.e. Example 1. generates all models only. Example 2 generates Pet and User models only.
However, if the -Dmodels option is appended on the end instead e.g.
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ -i http://petstore.swagger.io/v2/swagger.json \ -l java \ -o samples/client/petstore/java \ -Dmodels
Then for example 1. It will generate everything and for example 2. it will generate the first model in the list, so in this case, it will only generate the User model.
This is problematic as scripts which wrap java -jar /path/to/swagger-codegen-cli.jar such as homebrew install of swagger codegen don't allow the option to be passed in before -jar
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
Reproduce the two documented commands and the appended -Dmodels form using modules/swagger-codegen-cli/target/swagger-codegen-cli.jar. Trace how the CLI parses -Dmodels before and after -jar; done when both positions produce the same selected models, including all models when no value is supplied.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100