Skip to content

[Flask] incomplete reserved words list #6111

@chubinou

Description

@chubinou
Description
  • some python reserved keywords (self, None) are not escaped properly
  • some python3 reserved keywords (True, False) are not escaped
Swagger-codegen version

2.2.3

Swagger declaration file content or url
%YAML 1.0
---
swagger: '2.0'
info:
  version: v1
paths:
  /link:
    get:
      responses:
        "200":
          schema:
            $ref: "#/definitions/True"
        "400":
          schema:
            $ref: "#/definitions/self"
definitions:
  True:
    type: object
    properties:
      True:
        type: string
  self:
    type: object
    properties:
      self:
        type: integer

this produce a Link model like

#swagger_server/models/self.py
class Self(Model):
    def __init__(self, self: int=None):
        "..."
        self._self = self
#swagger_server/models/true.py
class True(Model):
    def __init__(self, true: str=None):
        "..."
        
Suggest a fix/enhancement

setReservedWordsLowerCase is called twice, the second time with an incomplete list

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions