Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.jsonschema;
 
 
Container for a logical JSON Schema instance. Internally schema data is stored as a JSON Tree (instance of com.fasterxml.jackson.databind.JsonNode is the root of schema document)

Deprecated:
Since 2.2, we recommend use of external JSON Schema generator module</module>
Author(s):
Ryan Heaton
See also:
JSON Schema
public class JsonSchema
    private final ObjectNode schema;

    
Main constructor for schema instances.

This is the creator constructor used by Jackson itself when deserializing instances. It is so-called delegating creator, meaning that its argument will be bound by Jackson before constructor gets called.

    @JsonCreator
    public JsonSchema(ObjectNode schema)
    {
        this. = schema;
    }

    
Method for accessing root JSON object of the contained schema.

Note: this method is specified with com.fasterxml.jackson.annotation.JsonValue annotation to represent serialization to use; same as if explicitly serializing returned object.

Returns:
Root node of the schema tree
    @JsonValue
    public ObjectNode getSchemaNode()
    {
        return ;
    }
    @Override
    public String toString()
    {
        return this..toString();
    }
    @Override
    public int hashCode()
    {
        return .hashCode();
    }
    @Override
    public boolean equals(Object o)
    {
        if (o == thisreturn true;
        if (o == nullreturn false;
        if (!(o instanceof JsonSchema)) return false;
        JsonSchema other = (JsonSchemao;
        if ( == null) {
            return other.schema == null;
        }
        return .equals(other.schema);
    }

    
Get the default schema node.

Returns:
The default schema node.
    public static JsonNode getDefaultSchemaNode()
    {
        ObjectNode objectNode = ..objectNode();
        objectNode.put("type""any");
        // "required" is false by default, no need to include
        //objectNode.put("required", false);
        return objectNode;
    }
New to GrepCode? Check out our FAQ X