It would be very suitable to add new flag for Java/Kotlin generation --datetime-format MY-CUSTOM-FORMAT
Context (Input, Language)
Input Format: flag for cli - --datetime-format
Output Language: Java, Kotlin
Description
Very often we need to provide custom datetime format; In case when automatically generated classes are published as standalone artifact (jar library for nexus). We can't change them at this moment.
Current Behaviour / Output
Not possible
Proposed Behaviour / Output
Inside generated classes would be custom format for datetime
private static final DateTimeFormatter DATE_TIME_FORMATTER = new DateTimeFormatterBuilder()
.appendOptional(DateTimeFormatter.ISO_DATE_TIME)
.appendOptional(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
.appendOptional(DateTimeFormatter.ISO_INSTANT)
.appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SX"))
.appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ssX"))
.appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
.appendOptional(DateTimeFormatter.ofPattern("MY-CUSTOM-FORMAT")) // adds own format
.toFormatter()
.withZone(ZoneOffset.UTC);
Context
I wrapped quicktype cli into gradle plugin, that generates Java classes and publishes them as artifacts that can be added to project as a dependency. Now I can't provide custom date time format in config. I see bad workaround how i can do this, but it's seems inconvenient to me (need to parse generated classes and insert new line in every generated class, which is too ugly).
It would be very suitable to add new flag for Java/Kotlin generation
--datetime-format MY-CUSTOM-FORMATContext (Input, Language)
Input Format: flag for
cli---datetime-formatOutput Language:
Java,KotlinDescription
Very often we need to provide custom datetime format; In case when automatically generated classes are published as standalone artifact (
jarlibrary for nexus). We can't change them at this moment.Current Behaviour / Output
Not possible
Proposed Behaviour / Output
Inside generated classes would be custom format for
datetimeContext
I wrapped
quicktypecli into gradle plugin, that generates Java classes and publishes them as artifacts that can be added to project as a dependency. Now I can't provide custom date time format in config. I see bad workaround how i can do this, but it's seems inconvenient to me (need to parse generated classes and insert new line in every generated class, which is too ugly).