swagger-api / swagger-api/swagger-codegen
Change case via python client config options?
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I would like to change my case format from snake to camel casing, ideally without having to extend the python generator (pretty new to the codegen!). Other languages are able to change the casing via their config options (either through a config.json or directly via jar). However, we don't have any of those options available as a supported config. Here is what the python client currently supports:
Current config options:
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 generation timestamp when files are generated. (Default: true)
library
library template (sub-template) to use (Default: urllib3)
Swagger-codegen version
Version 3.0.34
Command line used for generation
java -jar $SWAGGER_DIR/swagger-codegen-cli.jar generate \
-i $SWAGGER_DIR/swagger_api_definition.yml \
-o $SWAGGER_DIR/dist \
-l python \
-c $SWAGGER_DIR/python_config.json \
-t $SWAGGER_DIR/custom-templates/python
Related issues/PRs
- Github Issue with the open PR fix attached (PR for version 2 was already merged, but the PR for version 3 is still open).
- Many other github issues related to casing configs, but only apply to other languages (not many found for python).
Suggest a fix/enhancement
If the only option available is to extend the class, some sample code would be highly beneficial. Pretty new to the codegen. If it's able to be added to the config options, I can easily move forward by adding it to my config.json. I'm also surprised that we can't change the setUniqueParams like other language generators for codegen -- this would also be very useful for our API!
Thank you!
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 by reviewing the Python generator's listed config options and the related issue 7157. Compare the open version 3 PR 1039 with the current generator behavior, including the requested casing and setUniqueParams options. Done would mean a supported configuration path is defined and documented for the Python client.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100