swagger-api/swagger-codegen

Typescript: Dates Are Not Deserialized

Open

#2,776 opened on May 4, 2016

View on GitHub
 (18 comments) (17 reactions) (0 assignees)HTML (12,701 stars) (5,474 forks)batch import
Client: TypeScriptIssue: Bughelp wanted

Description

If you have a property in a definition that is a string with date-time format, the typescript generated model makes that property a Date type. However, the response in the client is given verbatim. It never looks for date strings and actually transforms them in to Date objects. So the project will build, but fails at runtime if you try to access Date specific methods since it's actually a string.

I imagine this relates to: https://github.com/swagger-api/swagger-codegen/issues/1951

Since this PR focuses on deserializing dates in the response. I would suggest making those properties strings until deserialization is supported, otherwise the type checking isn't actually accurate.

Contributor guide