joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc

Home Page:http://www.jsonschema2pojo.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

cah-johncrichton-mccutch opened this issue · comments

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"
    }

Hi

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