jsonchematic demos

keywords

{
  "title": "additionalItems set to false",
  "type": "array",
  "items": [
    {
      "type": "number"
    },
    {
      "type": "string"
    },
    {
      "type": "string",
      "enum": [
        "Street",
        "Avenue",
        "Boulevard"
      ]
    },
    {
      "type": "string",
      "enum": [
        "NW",
        "NE",
        "SW",
        "SE"
      ]
    }
  ],
  "additionalItems": false
}

additionalItems set to false

  • array
  • additional items not allowed
items
  1. /items#
    • number
    • /items#
      • string
      • /items#
        • string
        enum
        • Street
        • Avenue
        • Boulevard
        • /items#
          • string
          enum
          • NW
          • NE
          • SW
          • SE

            {
              "title": "additionalItems set to true",
              "type": "array",
              "items": [
                {
                  "type": "number"
                },
                {
                  "type": "string"
                },
                {
                  "type": "string",
                  "enum": [
                    "Street",
                    "Avenue",
                    "Boulevard"
                  ]
                },
                {
                  "type": "string",
                  "enum": [
                    "NW",
                    "NE",
                    "SW",
                    "SE"
                  ]
                }
              ],
              "additionalItems": true
            }

            additionalItems set to true

            • array
            • additional items allowed
            items
            1. /items#
              • number
              • /items#
                • string
                • /items#
                  • string
                  enum
                  • Street
                  • Avenue
                  • Boulevard
                  • /items#
                    • string
                    enum
                    • NW
                    • NE
                    • SW
                    • SE

                      {
                        "title": "additionalItems set to schema",
                        "type": "array",
                        "items": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "string"
                          },
                          {
                            "type": "string",
                            "enum": [
                              "Street",
                              "Avenue",
                              "Boulevard"
                            ]
                          },
                          {
                            "type": "string",
                            "enum": [
                              "NW",
                              "NE",
                              "SW",
                              "SE"
                            ]
                          }
                        ],
                        "additionalItems": {
                          "type": "number"
                        }
                      }

                      additionalItems set to schema

                      • array
                      items
                      1. /items#
                        • number
                        • /items#
                          • string
                          • /items#
                            • string
                            enum
                            • Street
                            • Avenue
                            • Boulevard
                            • /items#
                              • string
                              enum
                              • NW
                              • NE
                              • SW
                              • SE
                              additional items
                              /additionalItems#
                              • number

                                  {
                                    "title": "additionalItems with object items",
                                    "type": "array",
                                    "items": {
                                      "type": "number"
                                    },
                                    "additionalItems": {
                                      "type": "number"
                                    }
                                  }

                                  additionalItems with object items

                                  • array
                                  items
                                  /items#
                                  • number

                                      {
                                        "title": "with a $comment",
                                        "description": "this is the description",
                                        "$comment": "and this is the comment"
                                      }

                                      with a $comment

                                      this is the description
                                      and this is the comment

                                          {
                                            "title": "'true' as the schema",
                                            "type": "array",
                                            "items": true
                                          }

                                          'true' as the schema

                                          • array
                                          items
                                          schema matches anything

                                            {
                                              "title": "'false' as the schema",
                                              "type": "array",
                                              "items": false
                                            }

                                            'false' as the schema

                                            • array
                                            items
                                            schema matches nothing

                                              {
                                                "type": "object",
                                                "properties": {
                                                  "builtin": {
                                                    "type": "number"
                                                  }
                                                },
                                                "patternProperties": {
                                                  "^S_": {
                                                    "type": "string"
                                                  },
                                                  "^I_": {
                                                    "type": "integer"
                                                  }
                                                },
                                                "additionalProperties": {
                                                  "type": "string"
                                                },
                                                "title": "patternProperties"
                                              }

                                              patternProperties

                                              • object
                                                properties
                                                builtin
                                                undefined/properties/builtin#
                                                • number
                                                  pattern properties
                                                  ^I_
                                                  undefined/patternProperties/^I_#
                                                  • integer
                                                    ^S_
                                                    undefined/patternProperties/^S_#
                                                    • string

                                                      {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "number"
                                                        },
                                                        "title": "items as a schema"
                                                      }

                                                      items as a schema

                                                      • array
                                                      items
                                                      /items#
                                                      • number

                                                          {
                                                            "type": "array",
                                                            "items": [
                                                              {
                                                                "type": "number"
                                                              },
                                                              {
                                                                "type": "string"
                                                              }
                                                            ],
                                                            "title": "items as a tuple"
                                                          }

                                                          items as a tuple

                                                          • array
                                                          items
                                                          1. /items#
                                                            • number
                                                            • /items#
                                                              • string

                                                                {
                                                                  "type": "object",
                                                                  "propertyNames": {
                                                                    "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
                                                                  },
                                                                  "title": "propertyNames"
                                                                }

                                                                propertyNames

                                                                • object
                                                                  property names
                                                                    • value matches pattern ^[A-Za-z_][A-Za-z0-9_]*$

                                                                      {
                                                                        "title": "additionalProperties as `false`",
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "foo": {
                                                                            "type": "string"
                                                                          }
                                                                        },
                                                                        "additionalProperties": false
                                                                      }

                                                                      additionalProperties as `false`

                                                                      • object
                                                                        properties
                                                                        foo
                                                                        undefined/properties/foo#
                                                                        • string

                                                                          {
                                                                            "title": "additionalProperties as object",
                                                                            "type": "object",
                                                                            "properties": {
                                                                              "foo": {
                                                                                "type": "string"
                                                                              }
                                                                            },
                                                                            "additionalProperties": {
                                                                              "type": "string"
                                                                            }
                                                                          }

                                                                          additionalProperties as object

                                                                          • object
                                                                            properties
                                                                            foo
                                                                            undefined/properties/foo#
                                                                            • string

                                                                              {
                                                                                "title": "writeOnly",
                                                                                "writeOnly": true,
                                                                                "type": "string"
                                                                              }

                                                                              writeOnly

                                                                              write-only
                                                                              • string

                                                                                {
                                                                                  "title": "readOnly",
                                                                                  "readOnly": true,
                                                                                  "type": "string"
                                                                                }

                                                                                readOnly

                                                                                read-only
                                                                                • string

                                                                                  {
                                                                                    "title": "not",
                                                                                    "type": "string",
                                                                                    "not": {
                                                                                      "maxLength": 5
                                                                                    }
                                                                                  }

                                                                                  not

                                                                                  • string
                                                                                    not
                                                                                      • ≤ 5

                                                                                        {
                                                                                          "title": "anyOf",
                                                                                          "anyOf": [
                                                                                            {
                                                                                              "type": "string",
                                                                                              "maxLength": 5
                                                                                            },
                                                                                            {
                                                                                              "type": "number",
                                                                                              "minimum": 0
                                                                                            }
                                                                                          ]
                                                                                        }

                                                                                        anyOf

                                                                                            anyOf
                                                                                            • string
                                                                                            • ≤ 5
                                                                                              • number
                                                                                              • ≥ 0

                                                                                                {
                                                                                                  "title": "oneOf",
                                                                                                  "oneOf": [
                                                                                                    {
                                                                                                      "type": "string",
                                                                                                      "maxLength": 5
                                                                                                    },
                                                                                                    {
                                                                                                      "type": "number",
                                                                                                      "minimum": 0
                                                                                                    }
                                                                                                  ]
                                                                                                }

                                                                                                oneOf

                                                                                                    oneOf
                                                                                                    • string
                                                                                                    • ≤ 5
                                                                                                      • number
                                                                                                      • ≥ 0

                                                                                                        {
                                                                                                          "title": "allOf",
                                                                                                          "allOf": [
                                                                                                            {
                                                                                                              "type": "string",
                                                                                                              "maxLength": 5
                                                                                                            },
                                                                                                            {
                                                                                                              "type": "number",
                                                                                                              "minimum": 0
                                                                                                            }
                                                                                                          ]
                                                                                                        }

                                                                                                        allOf

                                                                                                            allOf
                                                                                                            • string
                                                                                                            • ≤ 5
                                                                                                              • number
                                                                                                              • ≥ 0

                                                                                                                {
                                                                                                                  "title": "if-then-else",
                                                                                                                  "type": "object",
                                                                                                                  "properties": {
                                                                                                                    "street_address": {
                                                                                                                      "type": "string"
                                                                                                                    },
                                                                                                                    "country": {
                                                                                                                      "enum": [
                                                                                                                        "United States of America",
                                                                                                                        "Canada"
                                                                                                                      ]
                                                                                                                    }
                                                                                                                  },
                                                                                                                  "if": {
                                                                                                                    "properties": {
                                                                                                                      "country": {
                                                                                                                        "const": "United States of America"
                                                                                                                      }
                                                                                                                    }
                                                                                                                  },
                                                                                                                  "then": {
                                                                                                                    "properties": {
                                                                                                                      "postal_code": {
                                                                                                                        "pattern": "[0-9]{5}(-[0-9]{4})?"
                                                                                                                      }
                                                                                                                    }
                                                                                                                  },
                                                                                                                  "else": {
                                                                                                                    "properties": {
                                                                                                                      "postal_code": {
                                                                                                                        "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]"
                                                                                                                      }
                                                                                                                    }
                                                                                                                  }
                                                                                                                }

                                                                                                                if-then-else

                                                                                                                • object
                                                                                                                  properties
                                                                                                                  country
                                                                                                                  undefined/properties/country#
                                                                                                                    enum
                                                                                                                    • United States of America
                                                                                                                    • Canada
                                                                                                                      street_address
                                                                                                                      undefined/properties/street_address#
                                                                                                                      • string
                                                                                                                        if
                                                                                                                            properties
                                                                                                                            country
                                                                                                                            undefined/properties/country#
                                                                                                                              const
                                                                                                                              • United States of America
                                                                                                                                then
                                                                                                                                    properties
                                                                                                                                    postal_code
                                                                                                                                    undefined/properties/postal_code#
                                                                                                                                      • value matches pattern [0-9]{5}(-[0-9]{4})?
                                                                                                                                        else
                                                                                                                                            properties
                                                                                                                                            postal_code
                                                                                                                                            undefined/properties/postal_code#
                                                                                                                                              • value matches pattern [A-Z][0-9][A-Z] [0-9][A-Z][0-9]

                                                                                                                                                {
                                                                                                                                                  "type": "object",
                                                                                                                                                  "properties": {
                                                                                                                                                    "name": {
                                                                                                                                                      "type": "string"
                                                                                                                                                    },
                                                                                                                                                    "credit_card": {
                                                                                                                                                      "type": "number"
                                                                                                                                                    }
                                                                                                                                                  },
                                                                                                                                                  "required": [
                                                                                                                                                    "name"
                                                                                                                                                  ],
                                                                                                                                                  "dependencies": {
                                                                                                                                                    "credit_card": {
                                                                                                                                                      "properties": {
                                                                                                                                                        "billing_address": {
                                                                                                                                                          "type": "string"
                                                                                                                                                        }
                                                                                                                                                      },
                                                                                                                                                      "required": [
                                                                                                                                                        "billing_address"
                                                                                                                                                      ]
                                                                                                                                                    }
                                                                                                                                                  }
                                                                                                                                                }
                                                                                                                                                • object
                                                                                                                                                  required
                                                                                                                                                  • name
                                                                                                                                                  properties
                                                                                                                                                  name
                                                                                                                                                  undefined/properties/name#
                                                                                                                                                  • string
                                                                                                                                                    credit_card
                                                                                                                                                    undefined/properties/credit_card#
                                                                                                                                                    • number
                                                                                                                                                    dependencies
                                                                                                                                                        required
                                                                                                                                                        • billing_address
                                                                                                                                                        properties
                                                                                                                                                        billing_address
                                                                                                                                                        undefined/properties/billing_address#
                                                                                                                                                        • string

                                                                                                                                                            {
                                                                                                                                                              "title": "property dependencies",
                                                                                                                                                              "type": "object",
                                                                                                                                                              "properties": {
                                                                                                                                                                "name": {
                                                                                                                                                                  "type": "string"
                                                                                                                                                                },
                                                                                                                                                                "credit_card": {
                                                                                                                                                                  "type": "number"
                                                                                                                                                                },
                                                                                                                                                                "billing_address": {
                                                                                                                                                                  "type": "string"
                                                                                                                                                                }
                                                                                                                                                              },
                                                                                                                                                              "required": [
                                                                                                                                                                "name"
                                                                                                                                                              ],
                                                                                                                                                              "dependencies": {
                                                                                                                                                                "credit_card": [
                                                                                                                                                                  "billing_address"
                                                                                                                                                                ]
                                                                                                                                                              }
                                                                                                                                                            }

                                                                                                                                                            property dependencies

                                                                                                                                                            • object
                                                                                                                                                              required
                                                                                                                                                              • name
                                                                                                                                                              properties
                                                                                                                                                              name
                                                                                                                                                              undefined/properties/name#
                                                                                                                                                              • string
                                                                                                                                                                billing_address
                                                                                                                                                                undefined/properties/billing_address#
                                                                                                                                                                • string
                                                                                                                                                                  credit_card
                                                                                                                                                                  undefined/properties/credit_card#
                                                                                                                                                                  • number
                                                                                                                                                                  • billing_address

                                                                                                                                                                    {
                                                                                                                                                                      "title": "null type",
                                                                                                                                                                      "type": "null"
                                                                                                                                                                    }

                                                                                                                                                                    null type

                                                                                                                                                                    • null

                                                                                                                                                                      {
                                                                                                                                                                        "title": "string w/ enum",
                                                                                                                                                                        "type": "string",
                                                                                                                                                                        "enum": [
                                                                                                                                                                          "potato",
                                                                                                                                                                          "cauliflower",
                                                                                                                                                                          "beet"
                                                                                                                                                                        ]
                                                                                                                                                                      }

                                                                                                                                                                      string w/ enum

                                                                                                                                                                      • string
                                                                                                                                                                      enum
                                                                                                                                                                      • potato
                                                                                                                                                                      • cauliflower
                                                                                                                                                                      • beet

                                                                                                                                                                        {
                                                                                                                                                                          "title": "string w/ const",
                                                                                                                                                                          "type": "string",
                                                                                                                                                                          "const": "potato"
                                                                                                                                                                        }

                                                                                                                                                                        string w/ const

                                                                                                                                                                        • string
                                                                                                                                                                        const
                                                                                                                                                                        • potato

                                                                                                                                                                          {
                                                                                                                                                                            "title": "string w/ content type and encoding",
                                                                                                                                                                            "type": "string",
                                                                                                                                                                            "contentEncoding": "base64",
                                                                                                                                                                            "contentMediaType": "image/png"
                                                                                                                                                                          }

                                                                                                                                                                          string w/ content type and encoding

                                                                                                                                                                          • string
                                                                                                                                                                          • encoding: base64
                                                                                                                                                                          • media type: image/png

                                                                                                                                                                            {
                                                                                                                                                                              "title": "object with properties, required, minProperties, maxProperties",
                                                                                                                                                                              "type": "object",
                                                                                                                                                                              "properties": {
                                                                                                                                                                                "foo": {
                                                                                                                                                                                  "type": "string"
                                                                                                                                                                                },
                                                                                                                                                                                "bar": {
                                                                                                                                                                                  "type": "number"
                                                                                                                                                                                },
                                                                                                                                                                                "baz": {
                                                                                                                                                                                  "type": "boolean"
                                                                                                                                                                                }
                                                                                                                                                                              },
                                                                                                                                                                              "required": [
                                                                                                                                                                                "foo"
                                                                                                                                                                              ],
                                                                                                                                                                              "minProperties": 2,
                                                                                                                                                                              "maxProperties": 3
                                                                                                                                                                            }

                                                                                                                                                                            object with properties, required, minProperties, maxProperties

                                                                                                                                                                            • object
                                                                                                                                                                            • nbr properties: 2...3
                                                                                                                                                                            required
                                                                                                                                                                            • foo
                                                                                                                                                                            properties
                                                                                                                                                                            foo
                                                                                                                                                                            undefined/properties/foo#
                                                                                                                                                                            • string
                                                                                                                                                                              bar
                                                                                                                                                                              undefined/properties/bar#
                                                                                                                                                                              • number
                                                                                                                                                                                baz
                                                                                                                                                                                undefined/properties/baz#
                                                                                                                                                                                • boolean

                                                                                                                                                                                  {
                                                                                                                                                                                    "title": "string with a date-time format",
                                                                                                                                                                                    "type": "string",
                                                                                                                                                                                    "format": "date-time",
                                                                                                                                                                                    "description": "the format comes with a tooltip too! Hover over the format to see it."
                                                                                                                                                                                  }

                                                                                                                                                                                  string with a date-time format

                                                                                                                                                                                  the format comes with a tooltip too! Hover over the format to see it.
                                                                                                                                                                                  • string

                                                                                                                                                                                    {
                                                                                                                                                                                      "title": "examples",
                                                                                                                                                                                      "type": "number",
                                                                                                                                                                                      "examples": [
                                                                                                                                                                                        1,
                                                                                                                                                                                        2,
                                                                                                                                                                                        3
                                                                                                                                                                                      ]
                                                                                                                                                                                    }

                                                                                                                                                                                    examples

                                                                                                                                                                                    • number
                                                                                                                                                                                      examples
                                                                                                                                                                                      1
                                                                                                                                                                                          
                                                                                                                                                                                      2
                                                                                                                                                                                          
                                                                                                                                                                                      3
                                                                                                                                                                                          

                                                                                                                                                                                      {
                                                                                                                                                                                        "title": "object examples",
                                                                                                                                                                                        "type": "object",
                                                                                                                                                                                        "examples": [
                                                                                                                                                                                          {
                                                                                                                                                                                            "level": 3
                                                                                                                                                                                          }
                                                                                                                                                                                        ]
                                                                                                                                                                                      }

                                                                                                                                                                                      object examples

                                                                                                                                                                                      • object
                                                                                                                                                                                        examples
                                                                                                                                                                                        {
                                                                                                                                                                                          "level": 3
                                                                                                                                                                                        }
                                                                                                                                                                                            

                                                                                                                                                                                        {
                                                                                                                                                                                          "title": "array type",
                                                                                                                                                                                          "type": "array",
                                                                                                                                                                                          "maxItems": 10,
                                                                                                                                                                                          "minItems": 3,
                                                                                                                                                                                          "maxContains": 2,
                                                                                                                                                                                          "minContains": 1,
                                                                                                                                                                                          "uniqueItems": true
                                                                                                                                                                                        }

                                                                                                                                                                                        array type

                                                                                                                                                                                        • array
                                                                                                                                                                                        • items: 3...10
                                                                                                                                                                                        • contains: 1...2
                                                                                                                                                                                        • unique

                                                                                                                                                                                          {
                                                                                                                                                                                            "title": "boolean type",
                                                                                                                                                                                            "type": "boolean"
                                                                                                                                                                                          }

                                                                                                                                                                                          boolean type

                                                                                                                                                                                          • boolean

                                                                                                                                                                                            {
                                                                                                                                                                                              "title": "number w/ minimum, maximum",
                                                                                                                                                                                              "type": "number",
                                                                                                                                                                                              "minimum": 3,
                                                                                                                                                                                              "maximum": 10
                                                                                                                                                                                            }

                                                                                                                                                                                            number w/ minimum, maximum

                                                                                                                                                                                            • number
                                                                                                                                                                                            • ≥ 3
                                                                                                                                                                                            • ≤ 10

                                                                                                                                                                                              {
                                                                                                                                                                                                "title": "number w/ exclusiveMinimum, exclusiveMaximum",
                                                                                                                                                                                                "type": "number",
                                                                                                                                                                                                "exclusiveMinimum": 3,
                                                                                                                                                                                                "exclusiveMaximum": 10
                                                                                                                                                                                              }

                                                                                                                                                                                              number w/ exclusiveMinimum, exclusiveMaximum

                                                                                                                                                                                              • number
                                                                                                                                                                                              • > 3
                                                                                                                                                                                              • < 10

                                                                                                                                                                                                {
                                                                                                                                                                                                  "title": "integer w/ exclusiveMinimum, exclusiveMaximum",
                                                                                                                                                                                                  "type": "integer",
                                                                                                                                                                                                  "exclusiveMinimum": 3,
                                                                                                                                                                                                  "exclusiveMaximum": 10
                                                                                                                                                                                                }

                                                                                                                                                                                                integer w/ exclusiveMinimum, exclusiveMaximum

                                                                                                                                                                                                • integer
                                                                                                                                                                                                • > 3
                                                                                                                                                                                                • < 10

                                                                                                                                                                                                  {
                                                                                                                                                                                                    "title": "number w/ multipleOf",
                                                                                                                                                                                                    "type": "number",
                                                                                                                                                                                                    "multipleOf": 3
                                                                                                                                                                                                  }

                                                                                                                                                                                                  number w/ multipleOf

                                                                                                                                                                                                  • number
                                                                                                                                                                                                  • ×3

                                                                                                                                                                                                    {
                                                                                                                                                                                                      "title": "integer w/ default",
                                                                                                                                                                                                      "type": "integer",
                                                                                                                                                                                                      "default": 13
                                                                                                                                                                                                    }

                                                                                                                                                                                                    integer w/ default

                                                                                                                                                                                                    • integer
                                                                                                                                                                                                    default
                                                                                                                                                                                                    13

                                                                                                                                                                                                      {
                                                                                                                                                                                                        "title": "string type w/ minLength, maxLength",
                                                                                                                                                                                                        "type": "string",
                                                                                                                                                                                                        "minLength": 3,
                                                                                                                                                                                                        "maxLength": 13
                                                                                                                                                                                                      }

                                                                                                                                                                                                      string type w/ minLength, maxLength

                                                                                                                                                                                                      • string
                                                                                                                                                                                                      • ≥ 3
                                                                                                                                                                                                      • ≤ 13

                                                                                                                                                                                                        {
                                                                                                                                                                                                          "title": "a simple ref",
                                                                                                                                                                                                          "$ref": "#/somewhere/else"
                                                                                                                                                                                                        }

                                                                                                                                                                                                        a simple ref

                                                                                                                                                                                                          extends

                                                                                                                                                                                                            {
                                                                                                                                                                                                              "type": "object",
                                                                                                                                                                                                              "$id": "http://yanick.github.io/jsonschematic",
                                                                                                                                                                                                              "$schema": "http://json-schema.org/draft-07/schema#",
                                                                                                                                                                                                              "title": "$id and regular $schema",
                                                                                                                                                                                                              "description": "if the $schema is one of the official json schema urls, the display will simply be v*number*"
                                                                                                                                                                                                            }
                                                                                                                                                                                                            http://yanick.github.io/jsonschematic#

                                                                                                                                                                                                            $id and regular $schema

                                                                                                                                                                                                            if the $schema is one of the official json schema urls, the display will simply be v*number*
                                                                                                                                                                                                            • object