@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { if (_delegateSerializer instanceof SchemaAware) { return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint); } return super.getSchema(provider, typeHint); }
@SuppressWarnings("deprecation") @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { if (_valueSerializer instanceof SchemaAware) { return ((SchemaAware)_valueSerializer).getSchema(provider, null); } return com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint, boolean isOptional) throws JsonMappingException { if (_delegateSerializer instanceof SchemaAware) { return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint, isOptional); } return super.getSchema(provider, typeHint); }
@SuppressWarnings("deprecation") @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { ObjectNode o = createSchemaNode("array", true); if (_elementSerializer != null) { JsonNode schemaNode = null; if (_elementSerializer instanceof SchemaAware) { schemaNode = ((SchemaAware) _elementSerializer).getSchema(provider, null); } if (schemaNode == null) { schemaNode = com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); } o.set("items", schemaNode); } return o; }
private ObjectNode simpleTypeSchema(JsonNode exampleValue) { try { Object valueAsJavaType = this.objectMapper.treeToValue(exampleValue, Object.class); SchemaAware valueSerializer = getValueSerializer(valueAsJavaType); return (ObjectNode) valueSerializer.getSchema(this.objectMapper.getSerializerProvider(), null); } catch (JsonProcessingException e) { throw new GenerationException("Unable to generate a schema for this json example: " + exampleValue, e); } }
/** * The method to be called by {@link ObjectMapper} * to generate <a href="http://json-schema.org/">JSON schema</a> for * given type. * * @param type The type for which to generate schema * * @deprecated Should not be used any more */ @Deprecated // since 2.6 public com.fasterxml.jackson.databind.jsonschema.JsonSchema generateJsonSchema(Class<?> type) throws JsonMappingException { /* no need for embedded type information for JSON schema generation (all * type information it needs is accessible via "untyped" serializer) */ JsonSerializer<Object> ser = findValueSerializer(type, null); JsonNode schemaNode = (ser instanceof SchemaAware) ? ((SchemaAware) ser).getSchema(this, null) : com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); if (!(schemaNode instanceof ObjectNode)) { throw new IllegalArgumentException("Class " + type.getName() +" would not be serialized as a JSON object and therefore has no schema"); } return new com.fasterxml.jackson.databind.jsonschema.JsonSchema((ObjectNode) schemaNode); }
schemaNode = ((SchemaAware) ser).getSchema(provider, hint, isOptional); } else {
@SuppressWarnings("deprecation") @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { if (_valueSerializer instanceof SchemaAware) { return ((SchemaAware)_valueSerializer).getSchema(provider, null); } return com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { return (_valueSerializer instanceof SchemaAware) ? ((SchemaAware) _valueSerializer).getSchema(provider, null) : JsonSchema.getDefaultSchemaNode(); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint, boolean isOptional) throws JsonMappingException { if (_delegateSerializer instanceof SchemaAware) { return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint, isOptional); } return super.getSchema(provider, typeHint); }
@SuppressWarnings("deprecation") @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { if (_valueSerializer instanceof SchemaAware) { return ((SchemaAware)_valueSerializer).getSchema(provider, null); } return com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint, boolean isOptional) throws JsonMappingException { if (_delegateSerializer instanceof SchemaAware) { return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint, isOptional); } return super.getSchema(provider, typeHint); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint, boolean isOptional) throws JsonMappingException { if (_delegateSerializer instanceof SchemaAware) { return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint, isOptional); } return super.getSchema(provider, typeHint); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { if (_delegateSerializer instanceof SchemaAware) { return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint); } return super.getSchema(provider, typeHint); }
@SuppressWarnings("deprecation") @Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { if (_valueSerializer instanceof SchemaAware) { return ((SchemaAware)_valueSerializer).getSchema(provider, null); } return com.fasterxml.jackson.databind.jsonschema.JsonSchema.getDefaultSchemaNode(); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { if (_delegateSerializer instanceof SchemaAware) { return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint); } return super.getSchema(provider, typeHint); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { return (_valueSerializer instanceof SchemaAware) ? ((SchemaAware) _valueSerializer).getSchema(provider, null) : JsonSchema.getDefaultSchemaNode(); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) throws JsonMappingException { if (_delegateSerializer instanceof SchemaAware) { return ((SchemaAware) _delegateSerializer).getSchema(provider, typeHint); } return super.getSchema(provider, typeHint); }
private ObjectNode simpleTypeSchema(JsonNode exampleValue) { try { Object valueAsJavaType = this.objectMapper.treeToValue(exampleValue, Object.class); SchemaAware valueSerializer = getValueSerializer(valueAsJavaType); return (ObjectNode) valueSerializer.getSchema(this.objectMapper.getSerializerProvider(), null); } catch (JsonProcessingException e) { throw new GenerationException("Unable to generate a schema for this json example: " + exampleValue, e); } }
private ObjectNode simpleTypeSchema(JsonNode exampleValue) { try { 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); } }