Swagger does not have an own Date type. Instead Date is supported via string (https://swagger.io/docs/specification/data-models/data-types/). The documentation might be for OpenAPI 3.0, but the part about the Date is also valid for 2.0. The format attribute supports two Date formats:
date – full-date notation as defined by RFC 3339, section 5.6, for example, 2017-07-21
date-time – the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
It would be a huge plus, if these types where transformed correctly whitin a DTO. So when receiving a response the DTO could just transform the string of these fields to date and vice versa when sending a request.
Swagger does not have an own Date type. Instead Date is supported via string (https://swagger.io/docs/specification/data-models/data-types/). The documentation might be for OpenAPI 3.0, but the part about the Date is also valid for 2.0. The
format
attribute supports two Date formats:It would be a huge plus, if these types where transformed correctly whitin a DTO. So when receiving a response the DTO could just transform the string of these fields to date and vice versa when sending a request.
One idea might be to use https://github.com/typestack/class-transformer within the DTOs and transform them with the
plainToClass
method.I know it is a lot to ask, but it would be a great feature which would save a lot of work because i work with a lot of dates.
This codegen is already great and this is the only thing i am missing so far .Thanks!