I have a POJO annotated with hibernate validator annotations:
public class UserDto {
@Length(min = 2, max = 5)
@NotEmpty
private String name;
@Length(min = 8)
@NotEmpty
private String password;
//getters and setters
}
From this POJO I want to be able to generate a schema that looks like this:
{"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"password": {
"type": "string",
"minLength" : 2,
"maxLength" : 5,
"required" : true
},
"name": {
"type": "string"
"minLength" : 8,
"required" : true
}
}
}
Is there a library that is able to do this?
I'm looking at https://github.com/FasterXML/jackson but I don't see out of the box support for this.
Pointers will be very welcomed! Thank you!