swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
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 test
java -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.
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-generationSwagger-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 test
java -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:
https://github.com/swagger-api/swagger-codegen/blob/1c5b1ab00e05f8256b2f2df32b1b784a9b365978/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java#L464