Date support
Fields that have the type Date are shown as "type":"number" in the Swagger spec. Generating a client API from that exposes the field as a Double.
The Swagger spec for a date should be "type": "string", "format": "date-time"; Generating a Swift client API from that results in a Date, as expected.
The issue belong to Kitura I think, as this is the place we generate the specification. Nonetheless, I think this is due to the way you set the JSON encoder for the date. The date type is extracted from that. Have you tried to set them, through these functions:
- encoders for setting the date to the date-time, using ISO 8601, or any format you want.
- decoders for decoding your dates accordingly.
Currently, there is a limitation, which is that the date are encoded properly only if you configure the encoders before the route registration.
The default is deferredToDate which falls back to the UNIX Epoch approach.
Thanks!
I just kinda assumed that the spec would be generated in the OpenAPI project, my bad.
I followed your advice and set the encoders/decoders; that does change the type to string, but doesn't set the format, which isn't ideal for the generated client library.
My guess is that, since you can use a custom format, it could be tricky to set. It could/should be done with ISO 8601. Do you mind creating an issue in the Kitura project, so we can have a look at? Thanks.