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.09k stars 6.03k forks source link

Add support for threetenbp datetime library for clients [Java] #3688

Closed mikeholler closed 7 years ago

mikeholler commented 8 years ago

Swagger currently provides code generation options for java.util.Date, java.time, and joda. Joda has shown to be lacking in some ways (notably only allowing for millisecond precision).

Android developers like myself (and developers on other systems constrained by Java version pre-1.8) needing microsecond or nanosecond precision, and developers hoping to migrate to Java 8 someday, have taken to using ThreeTenBP to bridge this gap.

In addition to being a backport of the Java 8 java.time APIs, ThreeTenBP is written and maintained by Steven Colbourne, author of Joda Time and JSR-310 (the standard that became java.time) and used by many Java developers stuck on pre-Java 8 systems.

I would like to start generating our Java clients using our Swagger specifications, but the biggest limiting factor in my doing so is the lack of support for ThreeTenBP as a date library option for Java. Could a "threetenbp" library option be added to the Java client generator?

cbornet commented 8 years ago

Interesting. That would replace joda I guess...

mikeholler commented 8 years ago

I don't know that it has to replace joda-time, since tons of people still use it. More of an (optional) addition than a replacement is what I'd think would be best.

cbornet commented 8 years ago

It would be at least our default dateLibrary : http://blog.joda.org/2009/11/why-jsr-310-isn-joda-time_4941.html

mikeholler commented 8 years ago

Yeah, I think switching it to the default makes sense.