{
  "$schema": "http://json-schema.org/draft-06/schema#",
  "title": "A JSON Schema for JavaScript API specification",
  "description": "API specification",
  "type": "object",
  "required": ["scriptappy", "info", "entries"],
  "additionalProperties": false,
  "patternProperties": {
    "^x-": {
      "$ref": "#/definitions/vendor"
    }
  },
  "properties": {
    "scriptappy": {
      "type": "string",
      "const": "x.y.z",
      "description": "The specification version the document uses"
    },
    "info": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "description": "A description of the API"
        },
        "name": {
          "type": "string",
          "description": "Name of the API"
        },
        "version": { "$ref": "#/definitions/version" },
        "license": {
          "type": "string",
          "description": "SPDX license identifier"
        },
        "stability": {
          "$ref": "#/definitions/stability"
        }
      },
      "required": ["name", "version"],
      "additionalProperties": false,
      "patternProperties": {
        "^x-": {
          "$ref": "#/definitions/vendor"
        }
      }
    },
    "examples": {
      "description": "Examples showing how to use this API.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "entries": {
      "additionalProperties": {
        "type": "object",
        "oneOf": [
          {
            "$ref": "#/definitions/entity-tier0"
          },
          {
            "$ref": "#/definitions/entity-tier1"
          },
          {
            "$ref": "#/definitions/entity-tier2"
          },
          {
            "$ref": "#/definitions/entity-tier3"
          }
        ]
      }
    },
    "definitions": {
      "additionalProperties": {
        "type": "object",
        "oneOf": [
          {
            "$ref": "#/definitions/entity-tier1"
          },
          {
            "$ref": "#/definitions/entity-tier2"
          },
          {
            "$ref": "#/definitions/entity-tier3"
          }
        ]
      }
    }
  },
  "definitions": {
    "version": {
      "type": "string",
      "pattern": "^[0-9]+.[0-9]+.[0-9]+(-[a-z0-9_.-]+)?$"
    },
    "vendor": true,
    "availability": {
      "type": "object",
      "properties": {
        "since": {
          "description": "API version from which owning entity is available.",
          "$ref": "#/definitions/version"
        },
        "deprecated": {
          "description": "Current deprecation status of owning entity.",
          "oneOf": [{ "type": "boolean" }, { "$ref": "#/definitions/deprecated" }]
        }
      },
      "additionalProperties": false,
      "examples": ["\n  \"since\": \"1.0.0\",\n  \"deprecated\": false\n"]
    },
    "deprecated": {
      "type": "object",
      "properties": {
        "since": {
          "description": "API version from which owning entity is considered deprecated.",
          "$ref": "#/definitions/version"
        },
        "description": {
          "description": "A short description and a recommendation on what to use instead of the deprecated entity.",
          "type": "string"
        }
      },
      "required": ["since"],
      "additionalProperties": false,
      "examples": [
        "\n  \"since\": \"1.4.5\",\n  \"description\": \"Deprecated since 1.4.5, use something else instead :P.\"\n"
      ]
    },
    "stability": {
      "description": "Stability of the entity",
      "type": "string",
      "enum": ["experimental", "stable", "locked"]
    }
  }
}
