'JSON schema from generic POJO with Jackson annotation

need to generate JSON schema for below definition where T can be single object or List of objects.

class Response<T> {    
    private T data;
}
e.g. Response<Emp> or Response<List<Dept>>

For single object I am able to achieve thru.

ObjectMapper objectMapper = new ObjectMapper();
JavaType type = objectMapper.getTypeFactory().constructParametricType(Response.class, Emp.class);
objectMapper.acceptJsonFormatVisitor(type, new SchemaFactoryWrapper());
JsonSchema jsonSchema = visitor.finalSchema();

but for List<Dept.class> - not sure.. any help would be appreciated

Also if any library exists for the same that can be maven enabled?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source