Optional flag which changes string to date in case of format data-time or date
See original GitHub issueIn the project I am working on, we use openapi v3.
The schema contains objects which use the type string
with the format date-time
.
example:
ExampleType:
title: ExampleType
type: object
properties:
id:
type: integer
validFrom:
type: string
format: date-time
example: "2012-10-27T17:18:30.966Z"
We did not want to convert the date everytime and therefore we created a middleware for the server and client-side that automatically converts it from string
to Date
.
When creating the models via the openapi-typescript-gencode
tool, the output models use the type string
(as intended).
But in our case we need it to be of type Date
, which is a special case.
Therefore an optional flag to enable this feature would be great.
What is needed?
It needs to remember the format
value and in case of date
or date-time
the output type should be Date
instead of string
.
About implementing it
I would try to implement it and in case that anyone wants to help me, that would be great.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (3 by maintainers)
Top GitHub Comments
@Nico i’ve added this to the roadmap, seems like a feature that is worth investigation!
@ferdikoomen here a the list for the frontends:
Angular
uses
JSON.stringify()
(source)axios
uses
JSON.stringify()
(source)fetch
has no automatic parsing (source)