{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Dataformat descriptor",
  "description": "This schema defines the properties of a data format",

  "type": "object",

  "properties": {
    "#extends": { "$ref": "../common/1.json#/definitions/reference" },
    "#description": { "$ref": "../common/1.json#/definitions/description" },
    "#schema_version": { "$ref": "../common/1.json#/definitions/version" }
  },

  "patternProperties": {
    "^[a-zA-Z_][a-zA-Z0-9_-]*$": {
      "oneOf": [
        { "$ref": "../common/1.json#/definitions/basetype" },
        { "$ref": "#/definitions/array1d" },
        { "$ref": "#/definitions/array2d" },
        { "$ref": "#/definitions/array3d" },
        { "$ref": "#/definitions/array4d" },
        { "$ref": "#/definitions/array5d" },
        { "$ref": "../common/1.json#/definitions/reference" },
        { "$ref": "#" }
      ]
    }
  },

  "additionalProperties": false,

  "definitions": {

    "array1d": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": [
        { "type": "integer" },
        {
          "oneOf": [
            { "$ref": "../common/1.json#/definitions/basetype" },
            { "$ref": "../common/1.json#/definitions/reference" },
            { "$ref": "#" }
          ]
        }
      ],
      "additionalItems": false
    },

    "array2d": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "items": [
        { "type": "integer" },
        { "type": "integer" },
        {
          "oneOf": [
            { "$ref": "../common/1.json#/definitions/basetype" },
            { "$ref": "../common/1.json#/definitions/reference" },
            { "$ref": "#" }
          ]
        }
      ],
      "additionalItems": false
    },

    "array3d": {
      "type": "array",
      "minItems": 4,
      "maxItems": 4,
      "items": [
        { "type": "integer" },
        { "type": "integer" },
        { "type": "integer" },
        {
          "oneOf": [
            { "$ref": "../common/1.json#/definitions/basetype" },
            { "$ref": "../common/1.json#/definitions/reference" },
            { "$ref": "#" }
          ]
        }
      ],
      "additionalItems": false
    },

    "array4d": {
      "type": "array",
      "minItems": 5,
      "maxItems": 5,
      "items": [
        { "type": "integer" },
        { "type": "integer" },
        { "type": "integer" },
        { "type": "integer" },
        {
          "oneOf": [
            { "$ref": "../common/1.json#/definitions/basetype" },
            { "$ref": "../common/1.json#/definitions/reference" },
            { "$ref": "#" }
          ]
        }
      ],
      "additionalItems": false
    },

    "array5d": {
      "type": "array",
      "minItems": 6,
      "maxItems": 6,
      "items": [
        { "type": "integer" },
        { "type": "integer" },
        { "type": "integer" },
        { "type": "integer" },
        { "type": "integer" },
        {
          "oneOf": [
            { "$ref": "../common/1.json#/definitions/basetype" },
            { "$ref": "../common/1.json#/definitions/reference" },
            { "$ref": "#" }
          ]
        }
      ],
      "additionalItems": false
    }

  }

}
