javajava-timefabric8zoneddatetimefabric8-maven-plugin

How to add a custom serializer/format for Java zoneddatetime with fabric8 maven plugin?


I am using fabric8 maven plugin to autogenerate Java classes for a CRD from it's yaml file. One of the fields is:

updated_time:
  format: date-time
  type: string

It's getting converted to a java.time.zoneddatetime field:

@com.fasterxml.jackson.annotation.JsonFormat(timezone = "UTC", pattern = "yyyy-MM-dd'T'HH:mm:ssX")
private java.time.ZonedDateTime updated_time;

I want to change the pattern above to yyyy-MM-dd'T'HH:mm:ssXXX , a timestamp with offset, so it can parse timestamps like 2023-08-07T06:43:19+00:00. How can I achieve this? On java-generator-maven-plugin v6.2.0, open to upgrade.


Solution

  • Version 6.8.1 of the fabric8 java-generator has been released and includes the relevant fix for this issue.