joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
http://www.jsonschema2pojo.org
Apache License 2.0
6.24k stars 1.66k forks source link

cli option --datetime-class 'java.sql.Time' does not work . defaults to string. #1596

Closed cah-johncrichton-mccutch closed 8 months ago

cah-johncrichton-mccutch commented 8 months ago

this command:

jsonschema2pojo --annotation-style JACKSON \
    --big-decimals \
    --date-class 'java.sql.Date' \
    --datetime-class 'java.sql.Time' \
    --disable-getters --disable-setters \
    --source-type JSONSCHEMA \
    --source src/main/resources/jsonschema/schema.json \
    --target src/main/java -303  \
    --useJakartaValidation \
    --omit-hashcode-and-equals  --omit-tostring --omit-generated-annotation \
    --package customer.data.entity \
    --class-prefix DATA

yields java.lang.String for the time formatted strings:

   "TIM": {
      "type": "string",
      "format": "time"
    }
unkish commented 8 months ago

Hi

To set class for "format": "time" one should use correct argument: --time-class. Format types are listed on wiki page