Edit on GitHub

Property Fields

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.

Types of Properties

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)

Examples

String Property

{
    "about" : { "type" : "string" }
}

String Enum

{
  "email_interval" : {
    "type" : "string",
    "enum": [
        { "default" : "unset", "description" : "unset" },
        { "default" : "immediate", "description" : "immediate" },
        { "default" : "daily", "description" : "daily" }
    ],
    "default" : "unset"
}

Boolean

{
    "blocked_by_me" : { "type" : "boolean" }
}

Integer

{
    "stock_level" : { "type" : "integer"}
}

Integer Enum

{
    "in_stock" : {
        "type": "integer",
        "enum": [
            { "default" : -1, "description" : "unknown" },
            { "default" : 0, "description" : "out_of_stock" },
            { "default" : 1, "description" : "in_stock" }
        ]
    }
}

Date-Time (String variant)

{
    "created_at" : { "type" : "string" , "format" : "date-time"}
}

URI (String variant)

{
    "image_large_url" : { "type" : "string", "format": "uri" }
}

Schema (another model referenced via JSON Pointer)

{
    "verified_identity" : { "$ref" : "verified_identity.json" }
}

Array Property

  • Simple Array
{
    "pin_thumbnail_urls" : { "type": "array" }
}
  • Array with item type (Array)
{
    "pin_thumbnail_urls" : {
            "type": "array",
            "items": {
                 "type": "string",
                 "format": "uri"
             }
    }
}

Set Property

  • Simple Set
{
    "contributors" : {
            "type": "array",
            "unique": "true"
    }
}
  • Set with item type (Set)
{
    "contributors" : {
            "type": "array",
            "unique": "true",
            "items": { "$ref": "user.json" }
    }
}

Map (Object)

  • Simple Map
{
    "some_map" : { "type": "object" }
}
  • Map with value types
{
    "some_map" : {
        "type": "object",
        “additionalProperties”: { "$ref" : “user.json” }
    }
}
  • Nested object type
{
    "some_map" : {
        "type": "object",
        "title": "nested",
        "properties": {
            "id": {"type": "integer"},
            "name": {"type": "string"}
        }
    }
}

Algebraic Data Type (ADT or oneOf)

{
	"items": {
		"oneOf" : [
			{ "$ref" : "pin.json" },
			{ "$ref" : "board.json" },
			{ "$ref" : "interest.json" },
			{ "$ref" : "user.json" }
		]
	}
}