Swagger-codegen: Generated python code does not take into account config.json?

Created on 5 Jul 2017  路  3Comments  路  Source: swagger-api/swagger-codegen

Description

I'm not having any success generating a Python client with a different module name. I don't know if I'm on the right track.

I created a config.json file like this (and I know it's parsing it since I got an error before fixing syntax):

{
"apiPackage": "xyz",
"modelPackage": "xyz",
"groupId":"xyz",
"artifactVersion":"1.0-xyz",
"artifactId":"xyz"
}

I also tried setting command line arguments like --api-package and --model-package but nothing is having any effect.

The module name always comes out "swagger_client". Any suggestion?

Swagger-codegen version

2.2.2

Python Question

Most helpful comment

The options for customizing Python API client is as follows:

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l python      

CONFIG OPTIONS
    packageName
        python package name (convention: snake_case). (Default: swagger_client)

    projectName
        python project name in setup.py (e.g. petstore-api).

    packageVersion
        python package version. (Default: 1.0.0)

    packageUrl
        python package URL.

    sortParamsByRequiredFlag
        Sort method arguments to place required parameters before optional parameters. (Default: true)

    hideGenerationTimestamp
        hides the timestamp when files were generated (Default: true)

I think those you provided are the options for customizing the Java API client.

Please give the above options a try and let us know if you still experience issue customizing the Python API client.

All 3 comments

The options for customizing Python API client is as follows:

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l python      

CONFIG OPTIONS
    packageName
        python package name (convention: snake_case). (Default: swagger_client)

    projectName
        python project name in setup.py (e.g. petstore-api).

    packageVersion
        python package version. (Default: 1.0.0)

    packageUrl
        python package URL.

    sortParamsByRequiredFlag
        Sort method arguments to place required parameters before optional parameters. (Default: true)

    hideGenerationTimestamp
        hides the timestamp when files were generated (Default: true)

I think those you provided are the options for customizing the Java API client.

Please give the above options a try and let us know if you still experience issue customizing the Python API client.

That worked. The config-help command is useful. I missed that part.

Thanks @wing328 !

@edwinevans np. Let us know if you need further help from the community.

It's also worth sharing with you that the Python API client in 2.3.0 has been refactored and I would suggest you to start with that instead of the one in the current master.

SNAPSHOT version of 2.3.0 can be found in https://github.com/swagger-api/swagger-codegen#compatibility

Was this page helpful?
0 / 5 - 0 ratings