swagger-api / swagger-api/swagger-codegen
property name "_" results in empty string var name
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Consider the following snippet from FireHydrant's spec:
"postV1PostMortemsReportsReportIdPublish": {
"type": "object",
"properties": {
"_": {
"type": "string",
"enum": [
"true"
]
},
This results in the generated variable name being empty; e.g.,
def __init__(self, =None, user_ids=None, team_ids=None, _configuration=None): # noqa: E501
(Note the empty variable name for the first parameter after self.)
I think the line above is what causes this/where it needs to be protected against, but I'm not positive. (There also may be some more appropriate place to protect against this - I haven't looked up all the places where it is called.)
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 in modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java at line 442, then inspect the places that call the relevant name-generation logic. Reproduce the FireHydrant-style property named "_" and verify that generated Python constructor parameters always have nonempty names, without breaking the other parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100