'Swagger codegen duplicate field
I try to generate model classes from swagger JSON. File is delivered and I have not so much control over it.
I have defined usage in my pom.xml:
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.26</version>
<executions>
<execution>
<id>some-name</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>
${project.basedir}/src/main/resources/swagger/file.swagger.json
</inputSpec>
<language>spring</language>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<dateLibrary>java8</dateLibrary>
<modelPackage>${project.groupId}.nba.swagger.domain</modelPackage>
<apiPackage>${project.groupId}.nba.swagger.api</apiPackage>
<swaggerDocketConfig>true</swaggerDocketConfig>
<sourceFolder>src/main/java</sourceFolder>
<library>spring-boot</library>
<java8>true</java8>
<ensureUniqueParams>true</ensureUniqueParams>
</configOptions>
</configuration>
</execution>
Inside file.swagger.json I have
"Customer": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier."
},
"type": {
"type": "string",
"description": "asdda"
},
"@type": {
"type": "string",
"description": "The class type of the actual resource (for type extension)."
}
}
}
Swagger codegen generates:
- @JsonProperty("@type") private String type = null;
- @JsonProperty("type") private String type = null;
and it makes code build fail
is there any option to force codegen to name field/methods differently?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
