swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.03k stars 6.03k forks source link

Java DateTimeTypeAdapter class is not using the right formatter. #4234

Closed junewoo-suk closed 7 years ago

junewoo-suk commented 7 years ago
Description

DateTimeTypeAdapter class has a variable private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); but it should be private final DateTimeFormatter formatter = ISODateTimeFormat.dateTimeParser();. For example, dates like yyyy-MM-ddTHH:mm:ssZ will not be parsable in the current version, but it will be possible with dateTimeParser function. The previous date format is a default date format from InnoDB passed to Django models

Swagger-codegen version

2.2.1

Suggest a Fix

DateTimeTypeAdapter.java private final DateTimeFormatter formatter = ISODateTimeFormat.dateTime(); to private final DateTimeFormatter formatter = ISODateTimeFormat.dateTimeParser();

cbornet commented 7 years ago

Yes, but:

cbornet commented 7 years ago

Fixed by #4473

wing328 commented 7 years ago

@junewoo-suk please pull the latest master to give it a try.

Thanks @kevinoid for the fix.

(we've just added Swagger Codegen to ProductHunt: https://www.producthunt.com/posts/swagger-codegen, pleae upvote when you've time)