I'm doing code generation with the open api generator tool to generate a typescript-axios
client, but unfortunately there's a couple of issues I'm running into.
long
. However, the interface it generates changes that property to _long
which is not correct. I can't find anywhere in the mustache template that is doing this so it must be happening in the CLI layer. Can this behavior be prevented?Swagger property definition:
"long": {
"type": "number",
"description": "The longitude location.",
"format": "double",
"nullable": true
}
Codegen interface property output:
/**
* The longitude location.
* @type {number}
* @memberof ...
*/
_long?: number | null;
date-time
format, the interface says it requires a Date
object. This is not ideal in our situation, but again this appears to happen at the CLI level so I can't prevent this behavior by modifying the mustache template.Swagger property definition:
"startDate": {
"type": "string",
"description": "Gets or sets the start date of the search date range.",
"format": "date-time",
"nullable": true
},
Codegen interface property output:
/**
* Gets or sets the start date of the search date range.
* @type {Date}
* @memberof ...
*/
startDate?: Date | null;
Thanks in advance for any help!
You can pass a type-mappings
to the CLI:
java -jar openapi-generator-4.2.3.jar generate --type-mappings DateTime=string
etc..
This will turn the type Date
into a string. Problem is that it doesn't matter if you define a date
or a date-time
in your schema definition. You will get only string
now.