{
  "definitions": {
    "AllOfProperties": {
      "description": "An intersection type combines multiple schemas into one",
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "allOf": {
          "description": "Combination values",
          "type": "array",
          "items": {
            "$ref": "#\/definitions\/OfValue"
          }
        }
      },
      "required": [
        "allOf"
      ]
    },
    "ArrayProperties": {
      "description": "Array properties",
      "type": "object",
      "properties": {
        "type": {
          "enum": [
            "array"
          ],
          "type": "string"
        },
        "items": {
          "$ref": "#\/definitions\/ArrayValue"
        },
        "maxItems": {
          "$ref": "#\/definitions\/PositiveInteger"
        },
        "minItems": {
          "$ref": "#\/definitions\/PositiveInteger"
        },
        "uniqueItems": {
          "type": "boolean"
        }
      },
      "required": [
        "type",
        "items"
      ]
    },
    "ArrayType": {
      "description": "An array contains an ordered list of a specific type",
      "allOf": [
        {
          "$ref": "#\/definitions\/CommonProperties"
        },
        {
          "$ref": "#\/definitions\/ArrayProperties"
        }
      ]
    },
    "ArrayValue": {
      "description": "Allowed values of an array item",
      "oneOf": [
        {
          "$ref": "#\/definitions\/BooleanType"
        },
        {
          "$ref": "#\/definitions\/NumberType"
        },
        {
          "$ref": "#\/definitions\/StringType"
        },
        {
          "$ref": "#\/definitions\/ReferenceType"
        },
        {
          "$ref": "#\/definitions\/GenericType"
        }
      ]
    },
    "BooleanProperties": {
      "description": "Boolean properties",
      "type": "object",
      "properties": {
        "type": {
          "enum": [
            "boolean"
          ],
          "type": "string"
        }
      },
      "required": [
        "type"
      ]
    },
    "BooleanType": {
      "description": "Represents a boolean value",
      "allOf": [
        {
          "$ref": "#\/definitions\/CommonProperties"
        },
        {
          "$ref": "#\/definitions\/ScalarProperties"
        },
        {
          "$ref": "#\/definitions\/BooleanProperties"
        }
      ]
    },
    "CombinationType": {
      "description": "A combination type is either a intersection or union type",
      "oneOf": [
        {
          "$ref": "#\/definitions\/AllOfProperties"
        },
        {
          "$ref": "#\/definitions\/OneOfProperties"
        }
      ]
    },
    "CommonProperties": {
      "description": "Common properties which can be used at any schema",
      "type": "object",
      "properties": {
        "title": {
          "description": "Distinct word which represents this schema",
          "type": "string"
        },
        "description": {
          "description": "General description of this schema, should not contain any new lines.",
          "type": "string"
        },
        "type": {
          "description": "JSON type of the property",
          "enum": [
            "object",
            "array",
            "boolean",
            "integer",
            "number",
            "string"
          ],
          "type": "string"
        },
        "nullable": {
          "description": "Indicates whether it is possible to use a null value",
          "type": "boolean"
        },
        "deprecated": {
          "description": "Indicates whether this schema is deprecated",
          "type": "boolean"
        },
        "readonly": {
          "description": "Indicates whether this schema is readonly",
          "type": "boolean"
        }
      }
    },
    "ContainerProperties": {
      "description": "Properties specific for a container",
      "type": "object",
      "properties": {
        "type": {
          "enum": [
            "object"
          ],
          "type": "string"
        }
      },
      "required": [
        "type"
      ]
    },
    "DefinitionValue": {
      "description": "Represents a concrete type definition",
      "oneOf": [
        {
          "$ref": "#\/definitions\/ObjectType"
        },
        {
          "$ref": "#\/definitions\/ArrayType"
        },
        {
          "$ref": "#\/definitions\/BooleanType"
        },
        {
          "$ref": "#\/definitions\/NumberType"
        },
        {
          "$ref": "#\/definitions\/StringType"
        },
        {
          "$ref": "#\/definitions\/CombinationType"
        }
      ]
    },
    "Definitions": {
      "description": "Schema definitions which can be reused",
      "type": "object",
      "additionalProperties": {
        "$ref": "#\/definitions\/DefinitionValue"
      }
    },
    "Discriminator": {
      "description": "Adds support for polymorphism. The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description",
      "type": "object",
      "properties": {
        "propertyName": {
          "description": "The name of the property in the payload that will hold the discriminator value",
          "type": "string"
        },
        "mapping": {
          "$ref": "#\/definitions\/DiscriminatorMapping"
        }
      },
      "required": [
        "propertyName"
      ]
    },
    "DiscriminatorMapping": {
      "description": "An object to hold mappings between payload values and schema names or references",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "EnumValue": {
      "description": "A list of possible enumeration values",
      "oneOf": [
        {
          "$ref": "#\/definitions\/StringArray"
        },
        {
          "$ref": "#\/definitions\/NumberArray"
        }
      ]
    },
    "GenericType": {
      "description": "Represents a generic type",
      "type": "object",
      "properties": {
        "$generic": {
          "type": "string"
        }
      },
      "required": [
        "$generic"
      ]
    },
    "Import": {
      "description": "Contains external definitions which are imported. The imported schemas can be used via the namespace",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "MapProperties": {
      "description": "Map specific properties",
      "type": "object",
      "properties": {
        "additionalProperties": {
          "$ref": "#\/definitions\/PropertyValue"
        },
        "maxProperties": {
          "$ref": "#\/definitions\/PositiveInteger"
        },
        "minProperties": {
          "$ref": "#\/definitions\/PositiveInteger"
        }
      },
      "required": [
        "additionalProperties"
      ]
    },
    "MapType": {
      "description": "A map contains variable key value entries of a specific type",
      "allOf": [
        {
          "$ref": "#\/definitions\/CommonProperties"
        },
        {
          "$ref": "#\/definitions\/ContainerProperties"
        },
        {
          "$ref": "#\/definitions\/MapProperties"
        }
      ]
    },
    "NumberArray": {
      "description": "Array number values",
      "type": "array",
      "items": {
        "type": "number"
      },
      "minItems": 1
    },
    "NumberProperties": {
      "description": "Number properties",
      "type": "object",
      "properties": {
        "type": {
          "enum": [
            "number",
            "integer"
          ],
          "type": "string"
        },
        "multipleOf": {
          "type": "number",
          "minimum": 0,
          "exclusiveMinimum": true
        },
        "maximum": {
          "type": "number"
        },
        "exclusiveMaximum": {
          "type": "boolean"
        },
        "minimum": {
          "type": "number"
        },
        "exclusiveMinimum": {
          "type": "boolean"
        }
      },
      "required": [
        "type"
      ]
    },
    "NumberType": {
      "description": "Represents a number value (contains also integer)",
      "allOf": [
        {
          "$ref": "#\/definitions\/CommonProperties"
        },
        {
          "$ref": "#\/definitions\/ScalarProperties"
        },
        {
          "$ref": "#\/definitions\/NumberProperties"
        }
      ]
    },
    "ObjectType": {
      "description": "An object represents either a struct or map type",
      "oneOf": [
        {
          "$ref": "#\/definitions\/StructType"
        },
        {
          "$ref": "#\/definitions\/MapType"
        }
      ]
    },
    "OfValue": {
      "description": "Allowed values in a combination schema",
      "oneOf": [
        {
          "$ref": "#\/definitions\/NumberType"
        },
        {
          "$ref": "#\/definitions\/StringType"
        },
        {
          "$ref": "#\/definitions\/BooleanType"
        },
        {
          "$ref": "#\/definitions\/ReferenceType"
        }
      ]
    },
    "OneOfProperties": {
      "description": "An union type can contain one of the provided schemas",
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "discriminator": {
          "$ref": "#\/definitions\/Discriminator"
        },
        "oneOf": {
          "description": "Combination values",
          "type": "array",
          "items": {
            "$ref": "#\/definitions\/OfValue"
          }
        }
      },
      "required": [
        "oneOf"
      ]
    },
    "PositiveInteger": {
      "description": "Positive integer value",
      "type": "integer",
      "minimum": 0
    },
    "Properties": {
      "description": "Properties of a schema",
      "type": "object",
      "additionalProperties": {
        "$ref": "#\/definitions\/PropertyValue"
      }
    },
    "PropertyValue": {
      "description": "Allowed values of an object property",
      "oneOf": [
        {
          "$ref": "#\/definitions\/BooleanType"
        },
        {
          "$ref": "#\/definitions\/NumberType"
        },
        {
          "$ref": "#\/definitions\/StringType"
        },
        {
          "$ref": "#\/definitions\/ArrayType"
        },
        {
          "$ref": "#\/definitions\/CombinationType"
        },
        {
          "$ref": "#\/definitions\/ReferenceType"
        },
        {
          "$ref": "#\/definitions\/GenericType"
        }
      ]
    },
    "ReferenceType": {
      "description": "Represents a reference to another schema",
      "type": "object",
      "properties": {
        "$ref": {
          "description": "Reference to the schema under the definitions key",
          "type": "string"
        },
        "$template": {
          "$ref": "#\/definitions\/TemplateProperties"
        }
      },
      "required": [
        "$ref"
      ]
    },
    "ScalarProperties": {
      "type": "object",
      "properties": {
        "format": {
          "description": "Describes the specific format of this type i.e. date-time or int64",
          "type": "string"
        },
        "enum": {
          "$ref": "#\/definitions\/EnumValue"
        },
        "default": {
          "$ref": "#\/definitions\/ScalarValue"
        }
      }
    },
    "ScalarValue": {
      "description": "Represents a scalar value",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        }
      ]
    },
    "StringArray": {
      "description": "Array string values",
      "type": "array",
      "items": {
        "type": "string"
      },
      "minItems": 1
    },
    "StringProperties": {
      "description": "String properties",
      "type": "object",
      "properties": {
        "type": {
          "enum": [
            "string"
          ],
          "type": "string"
        },
        "maxLength": {
          "$ref": "#\/definitions\/PositiveInteger"
        },
        "minLength": {
          "$ref": "#\/definitions\/PositiveInteger"
        },
        "pattern": {
          "format": "regex",
          "type": "string"
        }
      },
      "required": [
        "type"
      ]
    },
    "StringType": {
      "description": "Represents a string value",
      "allOf": [
        {
          "$ref": "#\/definitions\/CommonProperties"
        },
        {
          "$ref": "#\/definitions\/ScalarProperties"
        },
        {
          "$ref": "#\/definitions\/StringProperties"
        }
      ]
    },
    "StructProperties": {
      "description": "Struct specific properties",
      "type": "object",
      "properties": {
        "properties": {
          "$ref": "#\/definitions\/Properties"
        },
        "required": {
          "$ref": "#\/definitions\/StringArray"
        }
      },
      "required": [
        "properties"
      ]
    },
    "StructType": {
      "description": "A struct contains a fix set of defined properties",
      "allOf": [
        {
          "$ref": "#\/definitions\/CommonProperties"
        },
        {
          "$ref": "#\/definitions\/ContainerProperties"
        },
        {
          "$ref": "#\/definitions\/StructProperties"
        }
      ]
    },
    "TemplateProperties": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#\/definitions\/ReferenceType"
      }
    }
  },
  "title": "TypeSchema",
  "description": "TypeSchema meta schema which describes a TypeSchema",
  "type": "object",
  "properties": {
    "$import": {
      "$ref": "#\/definitions\/Import"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "type": {
      "enum": [
        "object"
      ],
      "type": "string"
    },
    "definitions": {
      "$ref": "#\/definitions\/Definitions"
    },
    "properties": {
      "$ref": "#\/definitions\/Properties"
    },
    "required": {
      "$ref": "#\/definitions\/StringArray"
    }
  },
  "required": [
    "title",
    "type",
    "properties"
  ]
}