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 and Type | Class and Description |
|---|---|
static class |
JsonSchema.JsonSchemaIdResolver |
| Constructor and Description |
|---|
JsonSchema() |
| Modifier and Type | Method and Description |
|---|---|
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()
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()
Attempt to return this JsonSchema as a
ValueTypeSchema |
boolean |
equals(Object obj) |
String |
get$ref()
|
String |
get$schema()
|
JsonSchema[] |
getDisallow()
|
JsonSchema[] |
getExtends()
|
String |
getId()
|
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 |
setDisallow(JsonSchema[] disallow)
|
void |
setExtends(JsonSchema[] extendsextends)
|
void |
setId(String id)
|
void |
setRequired(Boolean required)
|
public AnySchema asAnySchema()
AnySchemapublic ArraySchema asArraySchema()
ArraySchemapublic BooleanSchema asBooleanSchema()
BooleanSchemapublic ContainerTypeSchema asContainerSchema()
ContainerTypeSchemapublic IntegerSchema asIntegerSchema()
IntegerSchemapublic NullSchema asNullSchema()
NullSchemapublic NumberSchema asNumberSchema()
NumberSchemapublic ObjectSchema asObjectSchema()
ObjectSchemapublic SimpleTypeSchema asSimpleTypeSchema()
SimpleTypeSchemapublic StringSchema asStringSchema()
StringSchemapublic UnionTypeSchema asUnionTypeSchema()
UnionTypeSchemapublic ValueTypeSchema asValueSchemaSchema()
ValueTypeSchemapublic String get$ref()
public String get$schema()
public JsonSchema[] getDisallow()
public JsonSchema[] getExtends()
public String getId()
public Boolean getRequired()
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)
$ref - the $ref to setpublic void set$schema(String $schema)
$schema - the $schema to setpublic void setDisallow(JsonSchema[] disallow)
disallow - the disallow to setpublic void setExtends(JsonSchema[] extendsextends)
extendsextends - the extendsextends to setpublic void setId(String id)
id - the id to setpublic void setRequired(Boolean required)
required - the required to setpublic static JsonSchema minimalForFormat(com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes format)
format - the format to expectCopyright © 2012 fasterxml.com. All Rights Reserved.