We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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" } }}
The text was updated successfully, but these errors were encountered:
Deprecated JSON schema that comes with jackson-databind-2.2.2.jar works differently though. Here is the schema produced.
{"type": "object", "properties": { "birthDt": { "type": "number" }, "name": { "type": "string" } }}
Sorry, something went wrong.
Btw, this problem is not just with Date type. It occurs to long and int types.
{"type": "object", "properties": { "doubleProperty": { "type": "number" }, "name": { "type": "string" }, "floatProperty": { "type": "number" }, "longProperty": { "type": "number", "type": "integer" }, "birthDt": { "type": "number", "format": "UTC_MILLISEC", "type": "integer" }, "intProperty": { "type": "number", "type": "integer" } }}
45debbd
Duplication was caused by unnecessary 'type' fields (although Jackson type id handler should actually be able to coalesce these but...)
No branches or pull requests
The code produces the JSON schema with redundant types for Date field.
The text was updated successfully, but these errors were encountered: