-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Description
Description
We are using swagger codegen several years for Java and Node.JS projects and now implemented Python project.
We found codegen for Python doesn't preserve original names for models and variables, and converts them to underscored by default: petId => pet_id and in addition, supports or camel o pascal
But we want to preserve the case as it's working in Java/Javascript/Scala/C# based on CodegenConstants.MODEL_PROPERTY_NAMING_TYPE
Swagger-codegen version
2.4.41
Swagger declaration file content or url
Repository:
type: object
description: A local repo configuration
properties:
repoName:
type: string
description: The local repo name
location:
type: string
description: The local repo location
description:
type: string
description: The local repo description
RepoResults:
type: object
description: List of local repositories configuration
properties:
RepoConfig:
type: array
items:
$ref: '#/definitions/Repository'
Command line used for generation
Using maven with swagger-codegen-maven-plugin
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.41</version>
<executions>
<execution>
<id>python-swagger-client</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${basedir}/target/resources/services.yaml</inputSpec>
<output>${basedir}/target/generated_sources</output>
<templateDirectory>${basedir}/templates</templateDirectory>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<language>python</language>
<additionalProperties>
<property>case=camel</property>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
- Create a model that can contain variables with different cases
- Generate python code
- Expects that python can parse JSON payload with original cases
Related issues/PRs
Suggest a fix/enhancement
Add support for "original" type for "case" property like done for camel/snake
Metadata
Metadata
Assignees
Labels
No labels