{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/elm.json",
  "anyOf": [
    { "$ref": "#/definitions/Application" },
    { "$ref": "#/definitions/Package" }
  ],
  "definitions": {
    "Package": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "package"
        },
        "name": {
          "type": "string",
          "pattern": "^[^/]+/[^/]+$"
        },
        "summary": {
          "type": "string"
        },
        "license": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "enum": [
                "AGPL-3.0-only",
                "Apache-2.0",
                "BSD-2-Clause",
                "BSD-3-Clause",
                "BSL-1.0",
                "CC0-1.0",
                "CDDL-1.0",
                "CDDL-1.1",
                "EPL-1.0",
                "EPL-2.0",
                "GPL-2.0-only",
                "GPL-3.0-only",
                "ISC",
                "LGPL-2.0-only",
                "LGPL-2.1-only",
                "LGPL-2.1-or-later",
                "LGPL-3.0-only",
                "LGPL-3.0-or-later",
                "MIT",
                "MPL-2.0",
                "MS-PL",
                "UNLICENSED"
              ]
            }
          ]
        },
        "version": {
          "type": "string"
        },
        "exposed-modules": {
          "oneOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "patternProperties": {
                ".*": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "required": []
            }
          ]
        },
        "elm-version": {
          "$ref": "#/definitions/Range"
        },
        "dependencies": {
          "$ref": "#/definitions/PackageDependencies"
        },
        "test-dependencies": {
          "$ref": "#/definitions/PackageDependencies"
        }
      },
      "required": [
        "dependencies",
        "elm-version",
        "exposed-modules",
        "license",
        "name",
        "summary",
        "test-dependencies",
        "type",
        "version"
      ]
    },
    "Application": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "const": "application"
        },
        "source-directories": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "elm-version": {
          "$ref": "#/definitions/Version"
        },
        "dependencies": {
          "$ref": "#/definitions/ApplicationDependenciesGroup"
        },
        "test-dependencies": {
          "$ref": "#/definitions/ApplicationDependenciesGroup"
        }
      },
      "required": [
        "dependencies",
        "elm-version",
        "source-directories",
        "test-dependencies",
        "type"
      ]
    },
    "ApplicationDependenciesGroup": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "direct": {
          "$ref": "#/definitions/ApplicationDependencies"
        },
        "indirect": {
          "$ref": "#/definitions/ApplicationDependencies"
        }
      },
      "required": ["direct", "indirect"]
    },
    "ApplicationDependencies": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^[^/]+/[^/]+$": {
          "$ref": "#/definitions/Version"
        }
      },
      "required": []
    },
    "PackageDependencies": {
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {
        "^[^/]+/[^/]+$": {
          "$ref": "#/definitions/Range"
        }
      },
      "required": []
    },
    "Range": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+ <= v < [0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "Version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    }
  }
}
