-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Description
I have this schema definition:
"payPeriodStart": {
example: "2020-02-12T06:00:00Z",
required: true,
description: "Start of the pay period",
schema: {
type: "string",
format: "date-time",
},
}
}
When the type have a date-time format, the interface generated says that it requires a Date object.
Should be a string.
/**
*
* @param {string} a
* @param {Date} payPeriodStart Start of the pay period
* @param {Date} payPeriodEnd End of the pay period
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
reportsControllerGetRepaymentInstructionReport(a: string, payPeriodStart: Date, payPeriodEnd: Date, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<string> {I tried to use add --type-mappings DateTime=string to the CLI but then it will convert both Date and date-time to string, regardless.
This happens in typescript-axios generator
openapi-generator version
4.2.3
OpenAPI declaration file content or url
{
"parameters": [
{
"name": "payPeriodStart",
"in": "query",
"schema": {
"type": "string",
"format": "date-time"
},
"example": "2020-02-12T06:00:00Z",
"required": true,
"description": "Start of the pay period"
}
]
}Command line used for generation
java -Dcolor -jar openapi-generator-4.2.3.jar generate -i http://localhost:8080/openapi.json -g typescript-axios --remove-operation-id-prefix -t ../src/api_client/typescript-axios -c ../src/api_client/config.json -o ../src/api_clientSteps to reproduce
Related issues/PRs
Not sure if this is the intended behaviour but maybe the mapping in the CLI should recognise the difference between date and date-time.
Thanks!
Reactions are currently unavailable