You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the swagger-codegen-cli to generate our classes, however, we noticed a strange case where a property that is referenced to (as object) in another .yaml, gets added twice in our json at serialization..
This is possibly caused by the file having a setter/getter with 2 capitals, eg: getDOfferStatus().
openapi: 3.0.2info:
version: 0.14.00title: trip offersdescription: trip offerspaths: {}components:
schemas:
TripOfferSummary:
description: A set of offers for a given trip from origin to destinationtype: objectproperties:
dOfferStatus:
$ref: './otheryaml.openapi.yaml#/components/schemas/DOfferStatus'
Which is defined in the other yaml and gets generated inline as: notice we defined it with two capitals as it's a class.
Generate the classes, and serialize/deserialize them.
Suggest a fix/enhancement
I tried using a class by copy pasting the generated code, and added @JsonProperty("dOfferStatus") to the getters and setters of the Java Class. This immediately resolved the issue.
The text was updated successfully, but these errors were encountered:
Description
We are using the swagger-codegen-cli to generate our classes, however, we noticed a strange case where a property that is referenced to (as object) in another .yaml, gets added twice in our json at serialization..
This is possibly caused by the file having a setter/getter with 2 capitals, eg: getDOfferStatus().
Example response:
Swagger-codegen version
swagger codegen-cli v3
Swagger declaration file content or url
Which is defined in the other yaml and gets generated inline as: notice we defined it with two capitals as it's a class.
Command line used for generation
classpath = project.configurations["swaggerCodegen"]
mainClass = 'io.swagger.codegen.v3.cli.SwaggerCodegen'
args = [
'generate',
'--lang', spring,
'--input-spec', inputFile,
'--config', configFile,
'--output', 'build'
]
config file:
{
"artifactId":"trip-offers-openapi",
"language":"spring",
"modelPackage":"com.system.trip_offers",
"apiPackage":"com.system.api",
"library":"spring-boot",
"generateSupportingFiles":"false",
"interfaceOnly":"true",
"defaultInterfaces":"false",
"singleContentTypes":"true",
"dateLibrary":"java8-localdatetime",
"importMappings": {
"DOfferStatus":"com.otheryamlpackage.DOfferStatus",
}
}
Steps to reproduce
Generate the classes, and serialize/deserialize them.
Suggest a fix/enhancement
I tried using a class by copy pasting the generated code, and added @JsonProperty("dOfferStatus") to the getters and setters of the Java Class. This immediately resolved the issue.
The text was updated successfully, but these errors were encountered: