public abstract class JsonSchema extends Object
JSON (JavaScript Object Notation) JsonSchema defines the media type "application/schema+json", a JSON based format for defining the structure of JSON data. JSON JsonSchema provides a contract for what JSON data is required for a given application and how to interact with it. JSON JsonSchema is intended to define validation, documentation, hyperlink navigation, and interaction control of JSON data.
JSON (JavaScript Object Notation) JsonSchema is a JSON media type for defining the structure of JSON data. JSON JsonSchema provides a contract for what JSON data is required for a given application and how to interact with it. JSON JsonSchema is intended to define validation, documentation, hyperlink navigation, and interaction control of JSON data.An example JSON JsonSchema provided by the JsonSchema draft:
{ "name":"Product", "properties":{ "id":{ "type":"number", "description":"Product identifier", "required":true }, "name":{ "description":"Name of the product", "type":"string", "required":true }, "price":{ "required":true, "type": "number", "minimum":0, "required":true }, "tags":{ "type":"array", "items":{ "type":"string" } } }, "links":[ { "rel":"full", "href":"{id}" }, { "rel":"comments", "href":"comments/?id={id}" } ] }
Modifier | Constructor and Description |
---|---|
protected |
JsonSchema() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
_equals(JsonSchema that) |
protected static <T> boolean |
arraysEqual(T[] arr1,
T[] arr2) |
AnySchema |
asAnySchema()
Attempt to return this JsonSchema as an
AnySchema |
ArraySchema |
asArraySchema()
Attempt to return this JsonSchema as an
ArraySchema |
BooleanSchema |
asBooleanSchema()
Attempt to return this JsonSchema as a
BooleanSchema |
ContainerTypeSchema |
asContainerSchema()
Deprecated.
Since 2.7
|
ContainerTypeSchema |
asContainerTypeSchema()
Attempt to return this JsonSchema as a
ContainerTypeSchema |
IntegerSchema |
asIntegerSchema()
Attempt to return this JsonSchema as an
IntegerSchema |
NullSchema |
asNullSchema()
Attempt to return this JsonSchema as a
NullSchema |
NumberSchema |
asNumberSchema()
Attempt to return this JsonSchema as a
NumberSchema |
ObjectSchema |
asObjectSchema()
Attempt to return this JsonSchema as an
ObjectSchema |
SimpleTypeSchema |
asSimpleTypeSchema()
Attempt to return this JsonSchema as a
SimpleTypeSchema |
StringSchema |
asStringSchema()
Attempt to return this JsonSchema as a
StringSchema |
UnionTypeSchema |
asUnionTypeSchema()
Attempt to return this JsonSchema as an
UnionTypeSchema |
ValueTypeSchema |
asValueSchemaSchema()
Deprecated.
Since 2.7
|
ValueTypeSchema |
asValueTypeSchema()
Attempt to return this JsonSchema as a
ValueTypeSchema |
void |
enrichWithBeanProperty(com.fasterxml.jackson.databind.BeanProperty beanProperty)
Override this to add information specific to the property of bean
For example, bean validation annotations could be used to specify
value constraints in the schema
|
boolean |
equals(Object obj) |
protected static boolean |
equals(Object object1,
Object object2)
A utility method allowing to easily chain calls to equals() on members
without taking any risk regarding the ternary operator precedence.
|
String |
get$ref() |
String |
get$schema() |
String |
getDescription() |
JsonSchema[] |
getDisallow() |
JsonSchema[] |
getExtends() |
String |
getId() |
Boolean |
getReadonly() |
Boolean |
getRequired() |
abstract com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes |
getType() |
boolean |
isAnySchema()
determine if this JsonSchema is an
AnySchema . |
boolean |
isArraySchema()
determine if this JsonSchema is an
ArraySchema . |
boolean |
isBooleanSchema()
determine if this JsonSchema is an
BooleanSchema . |
boolean |
isContainerTypeSchema()
determine if this JsonSchema is an
ContainerTypeSchema . |
boolean |
isIntegerSchema()
determine if this JsonSchema is an
IntegerSchema . |
boolean |
isNullSchema()
determine if this JsonSchema is an
NullSchema . |
boolean |
isNumberSchema()
determine if this JsonSchema is an
NumberSchema . |
boolean |
isObjectSchema()
determine if this JsonSchema is an
ObjectSchema . |
boolean |
isSimpleTypeSchema()
determine if this JsonSchema is an
SimpleTypeSchema . |
boolean |
isStringSchema()
determine if this JsonSchema is an
StringSchema . |
boolean |
isUnionTypeSchema()
determine if this JsonSchema is an
UnionTypeSchema . |
boolean |
isValueTypeSchema()
determine if this JsonSchema is an
ValueTypeSchema . |
static JsonSchema |
minimalForFormat(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes format)
Create a schema which verifies only that an object is of the given format.
|
void |
set$ref(String $ref) |
void |
set$schema(String $schema) |
void |
setDescription(String description) |
void |
setDisallow(JsonSchema[] disallow) |
void |
setExtends(JsonSchema[] extendsextends) |
void |
setId(String id) |
void |
setReadonly(Boolean readonly) |
void |
setRequired(Boolean required) |
public AnySchema asAnySchema()
AnySchema
public ArraySchema asArraySchema()
ArraySchema
public BooleanSchema asBooleanSchema()
BooleanSchema
@Deprecated public ContainerTypeSchema asContainerSchema()
public ContainerTypeSchema asContainerTypeSchema()
ContainerTypeSchema
public IntegerSchema asIntegerSchema()
IntegerSchema
public NullSchema asNullSchema()
NullSchema
public NumberSchema asNumberSchema()
NumberSchema
public ObjectSchema asObjectSchema()
ObjectSchema
public SimpleTypeSchema asSimpleTypeSchema()
SimpleTypeSchema
public StringSchema asStringSchema()
StringSchema
public UnionTypeSchema asUnionTypeSchema()
UnionTypeSchema
@Deprecated public ValueTypeSchema asValueSchemaSchema()
public ValueTypeSchema asValueTypeSchema()
ValueTypeSchema
public String getId()
public String get$ref()
public String get$schema()
public JsonSchema[] getDisallow()
public JsonSchema[] getExtends()
public Boolean getRequired()
public Boolean getReadonly()
public String getDescription()
public abstract com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes getType()
public boolean isAnySchema()
AnySchema
.public boolean isArraySchema()
ArraySchema
.public boolean isBooleanSchema()
BooleanSchema
.public boolean isContainerTypeSchema()
ContainerTypeSchema
.public boolean isIntegerSchema()
IntegerSchema
.public boolean isNullSchema()
NullSchema
.public boolean isNumberSchema()
NumberSchema
.public boolean isObjectSchema()
ObjectSchema
.public boolean isSimpleTypeSchema()
SimpleTypeSchema
.public boolean isStringSchema()
StringSchema
.public boolean isUnionTypeSchema()
UnionTypeSchema
.public boolean isValueTypeSchema()
ValueTypeSchema
.public void set$ref(String $ref)
public void set$schema(String $schema)
public void setDisallow(JsonSchema[] disallow)
public void setExtends(JsonSchema[] extendsextends)
public void setId(String id)
public void setRequired(Boolean required)
public void setReadonly(Boolean readonly)
public void setDescription(String description)
public void enrichWithBeanProperty(com.fasterxml.jackson.databind.BeanProperty beanProperty)
beanProperty
- public static JsonSchema minimalForFormat(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes format)
format
- the format to expectprotected boolean _equals(JsonSchema that)
protected static boolean equals(Object object1, Object object2)
protected static <T> boolean arraysEqual(T[] arr1, T[] arr2)
Copyright © 2017 FasterXML. All rights reserved.