Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3428
Closed
Open
Issue created Jul 23, 2019 by Administrator@rootContributor

[BUG] Python generator incorrectly renames valid model names

Created by: rizwansaeed

Description

The generator is renaming valid model object names. Looking at https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java#L119 it seems that it is ignoring casing which means that valid names such as Property are being renamed to ModelProperty

openapi-generator version

4.1.0-SNAPSHOT

OpenAPI declaration file content or url
swagger: "2.0"
info:
  description: "API description"
  version: "1.0.0"
  title: "Demo API"
  license:
    name: "Apache 2.0"
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "host.com"
basePath: "/v2"
tags:
- name: "myapi"
  description: "do something"

schemes:
- "https"
- "http"
paths:
  /myroute:
    post:
      tags:
      - "myapi"
      summary: "add something"
      description: ""
      operationId: "addSomthing"
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        description: "Do Something"
        required: true
        schema:
          $ref: "#/definitions/Property"
      responses:
        405:
          description: "Invalid input"

definitions:
  Property:
    type: "object"
    properties:
      id:
        type: "integer"
        format: "int64"
Command line used for generation
$ docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/example.yml -g python -o /local/out/sdk
Suggest a fix

Preserve casing when checking for keywords

Assignee
Assign to
Time tracking