Properties are where most of your editing will be focused. This area allows us to specify the fields that are available on this model. The properties declaration is a map from the property name to an object that describes the property.
The keys should follow the same naming conventions as title field (lowercase, underscore separated). The value will be an object that can be one of the types specified earlier or a reference to another JSON-schema file (via JSON Pointer $ref
).
In addition, there is syntax for providing concrete subtypes such as dates, URIs, and emails as shown below. A full list can be seen under the JSON-Schema type-specific documentation here.
Type |
---|
String |
Boolean |
Integer |
Number |
Date-time Property (String variant) |
String Property |
URI Property (String variant) |
JSON Pointer Property ($ref ) |
Array Property |
Array Property with Item types |
Set Property |
Set Property with item types |
Object Property |
Object Property with item types |
Nested Object |
Algebraic Data Type (oneOf ) |
{
"about" : { "type" : "string" }
}
{
"email_interval" : {
"type" : "string",
"enum": [
{ "default" : "unset", "description" : "unset" },
{ "default" : "immediate", "description" : "immediate" },
{ "default" : "daily", "description" : "daily" }
],
"default" : "unset"
}
{
"blocked_by_me" : { "type" : "boolean" }
}
{
"stock_level" : { "type" : "integer"}
}
{
"in_stock" : {
"type": "integer",
"enum": [
{ "default" : -1, "description" : "unknown" },
{ "default" : 0, "description" : "out_of_stock" },
{ "default" : 1, "description" : "in_stock" }
]
}
}
{
"created_at" : { "type" : "string" , "format" : "date-time"}
}
{
"image_large_url" : { "type" : "string", "format": "uri" }
}
{
"verified_identity" : { "$ref" : "verified_identity.json" }
}
{
"pin_thumbnail_urls" : { "type": "array" }
}
{
"pin_thumbnail_urls" : {
"type": "array",
"items": {
"type": "string",
"format": "uri"
}
}
}
{
"contributors" : {
"type": "array",
"unique": "true"
}
}
{
"contributors" : {
"type": "array",
"unique": "true",
"items": { "$ref": "user.json" }
}
}
{
"some_map" : { "type": "object" }
}
{
"some_map" : {
"type": "object",
“additionalProperties”: { "$ref" : “user.json” }
}
}
{
"some_map" : {
"type": "object",
"title": "nested",
"properties": {
"id": {"type": "integer"},
"name": {"type": "string"}
}
}
}
oneOf
){
"items": {
"oneOf" : [
{ "$ref" : "pin.json" },
{ "$ref" : "board.json" },
{ "$ref" : "interest.json" },
{ "$ref" : "user.json" }
]
}
}