List of usage examples for com.fasterxml.jackson.databind.jsonschema SchemaAware getSchema
public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException;
From source file:com.googlecode.jsonschema2pojo.SchemaGenerator.java
private ObjectNode simpleTypeSchema(JsonNode exampleValue) { try {// w ww. java 2s . co m Object valueAsJavaType = OBJECT_MAPPER.treeToValue(exampleValue, Object.class); SchemaAware valueSerializer = getValueSerializer(valueAsJavaType); return (ObjectNode) valueSerializer.getSchema(OBJECT_MAPPER.getSerializerProvider(), null); } catch (JsonMappingException e) { throw new GenerationException("Unable to generate a schema for this json example: " + exampleValue, e); } catch (JsonProcessingException e) { throw new GenerationException("Unable to generate a schema for this json example: " + exampleValue, e); } }