Hello.
After switching plugin jsonschema2pojo-maven-plugin (version: 0.5.1) and creating json schema with type = string and format = date-time and after execution of mvn generate-sources,
generated java class has java.util.Date field type instead of java.lang.String.
Actually, It works good when using type=string and format=date.
My plugin:
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>0.5.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<sourceDirectory><PATH></sourceDirectory>
<outputDirectory><PATH></outputDirectory>
<targetPackage><PACKAGE></targetPackage>
</configuration>
</execution>
</executions>
</plugin>
When I add <dateTimeType>java.lang.String</dateTimeType>, then it works like a charm:
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>0.5.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<dateTimeType>java.lang.String</dateTimeType>
<sourceDirectory><PATH></sourceDirectory>
<outputDirectory><PATH></outputDirectory>
<targetPackage><PACKAGE></targetPackage>
</configuration>
</execution>
</executions>
</plugin>
But in https://joelittlejohn.github.io/jsonschema2pojo/site/0.5.1/generate-mojo.html#dateTimeType, there is a record below:
dateTimeType:
What type to use instead of string when adding string type fields of format date-time to generated Java types.
- Type: java.lang.String
- Since: 0.4.22
- Required: No
- Expression: ${jsonschema2pojo.dateTimeType}
So, default type which should be used in generated classes is java.lang.String and why it is not used?
Please check and fix it in next releases if there is some bug.
Thank you.