swagger-api / swagger-api/swagger-codegen
how to use -Dapis flag
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I'm trying to figure out how to use the -Dapis flag to filter the api paths being generated, but I can't seem to figure it out. And it's not documented with the other examples in https://github.com/swagger-api/swagger-codegen#selective-generation
Swagger-codegen version
3.0.30
Swagger declaration file content or url
https://petstore.swagger.io/v2/swagger.json
Command line used for generation
I've tried a few different things - none of them seem to work:
java -Dapis="/pet/{petId}/uploadImage" -jar swagger-codegen-cli.jar generate -l go -i https://petstore.swagger.io/v2/swagger.json -o testjava -Dapis="/pet" -jar swagger-codegen-cli.jar generate -l go -i https://petstore.swagger.io/v2/swagger.json -o test
Using the path tag (but capitalized for some reason, lowercase doesn't work) does generate all code for api path methods with that tag:
java -Dapis="Pet" -jar swagger-codegen-cli.jar generate -l go -i https://petstore.swagger.io/v2/swagger.json -o test
but I'd like to filter to a subset of these methods, if possible.
Suggest a fix/enhancement
Ideally, we could document how to use the -Dapis flag to filter apis.
reference
flag handling code appears to be here:
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 with the selective-generation section in the Swagger Codegen README and the flag-handling code in modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java around line 464. Use the provided Petstore specification and Go generation commands to verify the documented -Dapis syntax and whether path-level filtering is supported. Done means the README clearly explains the flag's accepted values and limitations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- cli, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100