swagger-codegen-generators
swagger-codegen-generators copied to clipboard
[Python] Unable to use both -DpackageName and -DpackageVersion parameters in one invocation
Description
When using -DpackageName
and -DpackageVersion
to specify values for NAME
and VERSION
in setup.py, whichever is the last parameter is the one that takes effect. The first one gets replaced by a default value.
Swagger-codegen version
3.0.22
Command line used for generation
The following invocation...
docker run --rm -v ${TARGET_DIR}:/local/path swaggerapi/swagger-codegen-cli-v3:3.0.22 generate \
-i /local/path/input.json \
-l python \
-o /local/path/package_directory \
-DpackageVersion=X.Y.Z \
-DpackageName=my_package_name
produces these values in setup.py:
NAME = "my_package_name"
VERSION = "1.0.0" # This is a default value
On the other hand, if I swap the order of -DpackageName
and -DpackageVersion
in the previous invocation so that the version comes last, setup.py contains these values:
NAME = "swagger-client" # This is a default value
VERSION = "X.Y.Z"
still true for 3.0.33.
For someone searching this later: the right (working at least) way to call this seems to be:
docker run --rm -v ${TARGET_DIR}:/local/path swaggerapi/swagger-codegen-cli-v3:3.0.22 generate \
-i /local/path/input.json \
-l python \
-o /local/path/package_directory \
-D"packageVersion=X.Y.Z,packageName=my_package_name"