Sample Schema

Validate against: http://json-schema.org/draft-07/schema#

Schema ID: https://raw.githubusercontent.com/dwhieb/jschemer/master/test/schemas/schema.json

Type: object

Description

This is a description of this schema. It should support basic inline HTML, as well as simple Markdown styling. This schema shows how each JSON Schema keyword appears on its own.

Developer Notes

This is a test comment, aimed at readers or maintainers of the schema. This will be displayed as “Developer Notes”.

Schema Definitions

This schema defines the following subschemas for reuse:

  • key

    Regular expression to match: [A-Za-z]+

Properties

The following properties are defined for this object:

  • Annotation Keywords: annotations

    Description

    This schema shows how annotation keywords are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • title Keyword: title

      Description

      This schema shows how the “title” keyword appears in jschemer documentation. Titles should also support basic Markdown syntax.

    • “default” Keyword: default

      Description

      This schema shows how the “default” keyword appears in jschemer documentation. The value of the “default” keyword should appear as an indented JSON string in a code block.

      Default Value

      The default value for this item is:

      {
        "id": "532708fd-b48e-48cb-9f3c-219f7aa53f80",
        "key": "LANG",
        "name": "language"
      }
    • “description” Keyword: description

      Description

      This schema shows how the "description" keyword appears in jschemer documentation. Descriptions should also support Markdown syntax.

    • “examples” Keyword: examples

      Description

      This schema shows how the “examples” keyword appears in jschemer documentation. Each example should be displayed as an indented JSON string in a code block.

      Examples

      The following are example values for this schema:

      • {
          "id": "532708fd-b48e-48cb-9f3c-219f7aa53f80",
          "key": "LANG",
          "name": "language"
        }
      • {
          "id": "1830a856-e826-418e-a6cb-782d207b1bae",
          "key": "MORPH",
          "name": "morpheme"
        }
    • “readOnly” Keyword: readOnly

      Read-only: true

      Description

      This schema shows how the “readOnly” keyword appears in jschemer documentation.

    • “writeOnly” Keyword: writeOnly

      Description

      This schema shows how the “writeOnly” keyword appears in jschemer documentation.

  • Keywords for Any Instance Type: any

    Description

    This schema shows how keywords that apply to any instance type are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • “const” Keyword: const

      Description

      This schema shows how the “const” keyword appears in jschemer documentation.

      This item must have the following value:

      "This is a constant value."
    • “enum” Keyword: enum

      Description

      This schema shows how the “enum” keyword appears in jschemer documentation.

      Allowed Values

      • 1
      • []
      • {}
      • true
    • “type” Keyword: type

      Type: string

      Description

      This schema shows how the “type” keyword appears in jschemer documentation.

  • Keywords for Array Instance Types: arrays

    Description

    This schema shows how keywords that apply to array instance types are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • “additionalItems” Keyword: additionalItems

      Description

      This schema shows how the “additionalItems” keyword appears in jschemer documentation. This keyword only applies when the “items” keyword is also present, and consists of an array of schemas. In this example, the first item in the array must be a string, and any additional items in the array must be numbers.

      Items

      The items in this array must adhere to the following schemas, in order:

      • Type: string

      Additional Items

      If there are additional items in the array, they must adhere to the following schema:

      additionalItems

      Type: number

    • “contains” Keyword: contains

      Description

      This schema shows how the “contains” keyword appears in jschemer documentation. In this example, at least one item in the array must be a string.

      Contains

      The array must contain at least one element that adheres to the following schema:

      contains

      Type: string

    • “items” Keyword as a Schema: itemsSchema

      Description

      This schema shows how the “items” keyword appears in jschemer documentation when the value of “items” is a single schema. In this example, each item must be a string with a minimum length of 1.

      Items

      Each item in this array must adhere to the following schema:

      itemsSchema

      Type: string

      Minimum length: 1

    • “items” Keyword as an Array: itemsArray

      Description

      This schema shows how the “items” keyword appears in jschemer documentation when the value of “items” is an array of schemas. In this example, the first item in the array must be null, and the second item in the array must be a string.

      Items

      The items in this array must adhere to the following schemas, in order:

      • Type: null

      • Type: string

    • “maxItems” Keyword: maxItems

      Description

      This schema shows how the “maxItems” keyword appears in jschemer documentation.

      Maximum number of items: 10

    • “minItems” Keyword: minItems

      Description

      This schema shows how the “minItems” keyword appears in jschemer documentation.

      Minimum number of items: 1

    • “uniqueItems” Keyword: uniqueItems

      Description

      This schema show how the “uniqueItems” keyword appears in jschemer documentation.

      Items must be unique: true

  • Keywords for Boolean Logic: booleans

    Description

    This schema shows how keywords that apply subschemas with boolean logic are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • “allOf” Keyword: allOf

      Description

      This schema shows how the “allOf” keyword appears in jschemer documentation. In this example, the instance must validate against both subschemas — it must have an “id” property and it must be an object.

      This item must also validate against all of the following schemas:

      • Required Properties

        • id
      • Type: object

    • “anyOf” Keyword: anyOf

      Description

      This schema shows how the “anyOf” keyword appears in jschemer documentation. In this example, the instance can validate against any of the subschemas — it may be either an object or an array.

      This item must also validate against at least one of the following schemas:

      • Type: object

      • Type: array

    • “not” Keyword: not

      Description

      This schema shows how the “not” keyword appears in jschemer documentation. In this example, the instance must not be null.

      This item must not validate against the following schema:

      not

      Type: null

    • “oneOf” Keyword: oneOf

      Description

      This schema shows how the “oneOf” keyword appears in jschemer documentation. In this example, the instance may be either an object or a string.

      This item must also validate against exactly one of the following schemas:

      • Type: object

      • Type: string

  • Keywords for Conditional Validation: conditionals

    Description

    This schema shows how keywords that apply subschemas conditionally are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • “if”, “then”, and “else” Keywords: ifThen

      Description

      This schema shows how the “if”, “then”, and “else” keywords are displayed in jschemer documentation. In this example, if the instance is a string, it must have a minimum length of 3 characters. If the instance is not a string, then it must be an object.

      Conditional Valiation Rules

      The following schema is used for conditional validation:

      ifThen

      Type: string

      If this item validates aginst the conditional schema shown above, it must also validate against the following schema:

      ifThen

      Minimum length: 3

      If this item does not validate against the conditional schema shown aboe, it must validate against the following schema instead:

      ifThen

      Type: object

  • Keywords for Referenced Schemas: references

    Description

    This schema shows how keywords that are defined by reference to other schemas are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • Schemas Defined in “definitions”: definitions

      Description

      This schema shows how schemas which reference definitions in the “definitions” property appear in jschemer documentation. In this example, the “key” property must validate against the “key” schema in the schema definitions.

      Properties

      The following properties are defined for this object:

      • key

        Referenced Schema

        This item must validate against the following schema:

        #/definitions/key

    • Schemas Referenced with “$ref”: ref

      Description

      This schema shows how schemas which reference external schemas using the “$ref” property appear in jschemer documentation. In this example, the “location” property references the GeoJSON schema. This schema also shows that properties on the referencing schema overwrite properties on the referenced schema, for the purpose of generating the jschemer documentation. For example, the referenced GeoJSON schema in this example has the title GeoJSON, but in the jschemer documentation this example will appear with the title Schemas Referenced with "$ref".

      Referenced Schema

      This item must validate against the following schema:

      http://geojson.org/schema/GeoJSON.json

  • Keywords for Non-JSON Data: nonJSON

    Description

    This schema shows how keywords that apply to non-JSON data encoded as a string are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • “contentEncoding” Keyword: contentEncoding

      Description

      This schema shows how the “contentEncoding” keyword appears in jschemer documentation.

      Content encoding: base64

    • “contentMediaType” Keyword: contentMediaType

      Description

      This schema shows how the “contentMediaType” keyword appears in jschemer documentation.

      Content media type: audio/wav

  • Keywords for Numeric Instance Types: numeric

    Description

    This schema shows how keywords that apply to numeric instance types are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • “exclusiveMaximum” Keyword: exclusiveMaximum

      Description

      This schema shows how the “exclusiveMaximum” keyword appears in jschemer documentation.

      Exclusive maximum: 10

    • “exclusiveMinimum” Keyword: exclusiveMinimum

      Description

      This schema shows how the “exclusiveMinimum” keyword appears in jschemer documentation.

      Exclusive minimum: -10

    • “maximum” Keyword: maximum

      Description

      This schema shows how the “maximum” keyword appears in jschemer documentation.

      Maximum: 9.99

    • “minimum” Keyword: minimum

      Description

      This schema shows how the “minimum” keyword appears in jschemer documentation.

      Minimum: -9.99

    • “multipleOf” Keyword: multipleOf

      Description

      This schema shows how the “multipleOf” keyword appears in jschemer documentation.

      Multiple of: 2

  • Keywords for Object Instances: objects

    Description

    This schema shows how keywords that apply to object instances are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • “additionalProperties” Keyword Set to Boolean: additionalPropertiesTrue

      Description

      This schema shows how the “additionalProperties” keyword appears in jschemer documentation when it is set a boolean value. In this example, the object has one defined property, “id”, and no other properties are allowed.

      Properties

      The following properties are defined for this object:

      • id

        Type: string

      Additional Properties

      Any additional properties must adhere to the following schema:

      No values are valid for this schema.

    • “additionalProperties” Keyword Set to a Schema: additionalPropertiesSchema

      Description

      This schema shows how the “additionalProperties” keyword appears in jschemer documentation when its value is another schema. In this example, the object has one defined property, “id”, but may have additional properties as long as those additional properties are strings.

      Properties

      The following properties are defined for this object:

      • id

        Type: string

      Additional Properties

      Any additional properties must adhere to the following schema:

      additionalPropertiesSchema

      Type: string

    • “dependencies” Keyword: dependencies

      Description

      This schema shows how the “dependencies” keyword appears in jschemer documentation. In this example, the object has two dependencies: 1) if the object has an “id” property, it must also have a “key” property; 2) if the object has a “startTime” property, it must also have an “endTime” property.

      Dependencies

      This object has the following dependencies between properties:

      • If the object has the id property, the object must also match the following schema:

        id

        Required Properties

        • key
      • If this object has the startTime property, it must have the following properties as well:

        • endTime
    • “maxProperties” Keyword: maxProperties

      Description

      This schema shows how the “maxProperties” keyword appears in jschemer documentation.

      Maximum number of properties: 5

    • “minProperties” Keyword: minProperties

      Description

      This schema shows how the “minProperties” keyword appears in jschemer documentation.

      Minimum number of properties: 1

    • “patternProperties” Keyword: patternProperties

      Description

      This schema shows how the “patternProperties” keyword appears in jschemer documentation. In this example, each property of the object must contain the string “-lang”, and the value of that property must be a string as well.

      Regular Expression Properties

      Property names which match one of the following regular expressions must validate against the associated schema.

      • -lang

        Type: string

    • “properties” Keyword: properties

      Description

      This schema shows how the “properties” keyword appears in jschemer documentation. In this example, the schema specifies two properties for the object: “id” and “name”, both of which must be strings.

      Properties

      The following properties are defined for this object:

      • id

        Type: string

      • name

        Type: string

    • “propertyNames” Keyword: propertyNames

      Description

      This schema shows how the “propertyNames” keyword appears in jschemer documentation. In this example, each property name in the object must contain at least 3 characters.

      Property Names

      Each property name in this object must adhere to the following schema:

      propertyNames

      Minimum length: 3

    • “required” Keyword: required

      Description

      This schema shows how the “required” keyword appears in jschemer documentation. In this example, the object must have an “id” property.

      Required Properties

      • id
  • Keywords for String Instances: strings

    Description

    This schema shows how keywords that apply to string instances are displayed in jschemer documentation.

    Properties

    The following properties are defined for this object:

    • “format” Keyword: format

      Description

      This schema shows how the “format” keyword appears in jschemer documentation.

      Format: date-time

    • “maxLength” Keyword: maxLength

      Description

      This schema shows how the “maxLength” keyword appears in jschemer documentation.

      Maximum length: 100

    • “minLength” Keyword: minLength

      Description

      This schema shows how the “minLength” keyword appears in jschemer documentation.

      Minimum length: 1

    • “pattern” Keyword: pattern

      Description

      This schema shows how the “pattern” keyword appears in jschemer documentation.

      Regular expression to match: [A-Za-z]{4}

  • Miscellaneous Tests: misc

    Description

    This schema provides a space to test other miscellaneous aspects of JSON Schema.

    Properties

    The following properties are defined for this object:

    • True Schema: trueSchema

      Description

      This schema shows how a schema whose value is true appears in jschemer documentation.

      Items

      Each item in this array must adhere to the following schema:

      This schema imposes no restrictions. All values are valid.

    • False Schema: falseSchema

      Description

      This schema shows how a schema whose value is false appears in jschemer documentation.

      Items

      Each item in this array must adhere to the following schema:

      No values are valid for this schema.