Skip to content

Schema generates multiple type qualifiers for Date, int, long data types #14

@aruld

Description

@aruld
public class Employee {

  protected Date birthDt;
  protected String name;
  public Date getBirthDt() {
    return birthDt;
  }

  public void setBirthDt(Date value) {
    this.birthDt = value;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public static void main(String[] args) throws Exception {
    ObjectMapper mapper = new ObjectMapper();
    JsonSchemaGenerator generator = new JsonSchemaGenerator(mapper);
    JsonSchema jsonSchema = generator.generateSchema(Employee.class);
    System.out.println(mapper.writeValueAsString(jsonSchema));
  }
}

The code produces the JSON schema with redundant types for Date field.

{"type": "object", "properties": {
  "name": {
    "type": "string"
  },
  "birthDt": {
    "type": "number",
    "format": "UTC_MILLISEC",
    "type": "integer"
  }
}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions