swagger-api/swagger-codegen

Typescript: Dates Are Not Deserialized

Open

#2776 aperta il 4 mag 2016

Vedi su GitHub
 (18 commenti) (17 reazioni) (0 assegnatari)HTML (5474 fork)batch import
Client: TypeScriptIssue: Bughelp wanted

Metriche repository

Star
 (12.701 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor