{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "additionalProperties": true,
  "type": "object",
  "required": [],
  "properties": {
    "requires-poetry": {
      "type": "string",
      "description": "The version constraint for Poetry itself.",
      "$ref": "#/definitions/dependency"
    },
    "requires-plugins": {
      "type": "object",
      "description": "Poetry plugins that are required for this project.",
      "$ref": "#/definitions/dependencies",
      "additionalProperties": false
    },
    "source": {
      "type": "array",
      "description": "A set of additional repositories where packages can be found.",
      "additionalProperties": {
        "$ref": "#/definitions/repository"
      },
      "items": {
        "$ref": "#/definitions/repository"
      }
    }
  },
  "definitions": {
    "repository": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the repository."
        },
        "url": {
          "type": "string",
          "description": "The url of the repository.",
          "format": "uri"
        },
        "priority": {
          "enum": [
            "primary",
            "supplemental",
            "explicit"
          ],
          "description": "Declare the priority of this repository."
        },
        "links": {
          "type": "boolean",
          "description": "Declare this as a link source. Links at uri/path can point to sdist or bdist archives."
        },
        "indexed": {
          "type": "boolean",
          "description": "For PEP 503 simple API repositories, pre-fetch and index the available packages. (experimental)"
        }
      }
    },
    "dependencies": {
      "type": "object",
      "patternProperties": {
        "^[a-zA-Z-_.0-9]+$": {
          "oneOf": [
            {
              "$ref": "#/definitions/dependency"
            },
            {
              "$ref": "#/definitions/long-dependency"
            },
            {
              "$ref": "#/definitions/git-dependency"
            },
            {
              "$ref": "#/definitions/file-dependency"
            },
            {
              "$ref": "#/definitions/path-dependency"
            },
            {
              "$ref": "#/definitions/url-dependency"
            },
            {
              "$ref": "#/definitions/multiple-constraints-dependency"
            },
            {
              "$ref": "#/definitions/dependency-options"
            }
          ]
        }
      }
    },
    "dependency": {
      "type": "string",
      "description": "The constraint of the dependency."
    },
    "long-dependency": {
      "type": "object",
      "required": [
        "version"
      ],
      "additionalProperties": false,
      "properties": {
        "version": {
          "type": "string",
          "description": "The constraint of the dependency."
        },
        "python": {
          "type": "string",
          "description": "The python versions for which the dependency should be installed."
        },
        "platform": {
          "type": "string",
          "description": "The platform(s) for which the dependency should be installed."
        },
        "markers": {
          "type": "string",
          "description": "The PEP 508 compliant environment markers for which the dependency should be installed."
        },
        "allow-prereleases": {
          "type": "boolean",
          "description": "Whether the dependency allows prereleases or not."
        },
        "allows-prereleases": {
          "type": "boolean",
          "description": "Whether the dependency allows prereleases or not."
        },
        "optional": {
          "type": "boolean",
          "description": "Whether the dependency is optional or not."
        },
        "extras": {
          "type": "array",
          "description": "The required extras for this dependency.",
          "items": {
            "type": "string"
          }
        },
        "source": {
          "type": "string",
          "description": "The exclusive source used to search for this dependency."
        }
      }
    },
    "git-dependency": {
      "type": "object",
      "required": [
        "git"
      ],
      "additionalProperties": false,
      "properties": {
        "git": {
          "type": "string",
          "description": "The url of the git repository."
        },
        "branch": {
          "type": "string",
          "description": "The branch to checkout."
        },
        "tag": {
          "type": "string",
          "description": "The tag to checkout."
        },
        "rev": {
          "type": "string",
          "description": "The revision to checkout."
        },
        "subdirectory": {
          "type": "string",
          "description": "The relative path to the directory where the package is located."
        },
        "python": {
          "type": "string",
          "description": "The python versions for which the dependency should be installed."
        },
        "platform": {
          "type": "string",
          "description": "The platform(s) for which the dependency should be installed."
        },
        "markers": {
          "type": "string",
          "description": "The PEP 508 compliant environment markers for which the dependency should be installed."
        },
        "allow-prereleases": {
          "type": "boolean",
          "description": "Whether the dependency allows prereleases or not."
        },
        "allows-prereleases": {
          "type": "boolean",
          "description": "Whether the dependency allows prereleases or not."
        },
        "optional": {
          "type": "boolean",
          "description": "Whether the dependency is optional or not."
        },
        "extras": {
          "type": "array",
          "description": "The required extras for this dependency.",
          "items": {
            "type": "string"
          }
        },
        "develop": {
          "type": "boolean",
          "description": "Whether to install the dependency in development mode."
        }
      }
    },
    "file-dependency": {
      "type": "object",
      "required": [
        "file"
      ],
      "additionalProperties": false,
      "properties": {
        "file": {
          "type": "string",
          "description": "The path to the file."
        },
        "subdirectory": {
          "type": "string",
          "description": "The relative path to the directory where the package is located."
        },
        "python": {
          "type": "string",
          "description": "The python versions for which the dependency should be installed."
        },
        "platform": {
          "type": "string",
          "description": "The platform(s) for which the dependency should be installed."
        },
        "markers": {
          "type": "string",
          "description": "The PEP 508 compliant environment markers for which the dependency should be installed."
        },
        "optional": {
          "type": "boolean",
          "description": "Whether the dependency is optional or not."
        },
        "extras": {
          "type": "array",
          "description": "The required extras for this dependency.",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "path-dependency": {
      "type": "object",
      "required": [
        "path"
      ],
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string",
          "description": "The path to the dependency."
        },
        "subdirectory": {
          "type": "string",
          "description": "The relative path to the directory where the package is located."
        },
        "python": {
          "type": "string",
          "description": "The python versions for which the dependency should be installed."
        },
        "platform": {
          "type": "string",
          "description": "The platform(s) for which the dependency should be installed."
        },
        "markers": {
          "type": "string",
          "description": "The PEP 508 compliant environment markers for which the dependency should be installed."
        },
        "optional": {
          "type": "boolean",
          "description": "Whether the dependency is optional or not."
        },
        "extras": {
          "type": "array",
          "description": "The required extras for this dependency.",
          "items": {
            "type": "string"
          }
        },
        "develop": {
          "type": "boolean",
          "description": "Whether to install the dependency in development mode."
        }
      }
    },
    "url-dependency": {
      "type": "object",
      "required": [
        "url"
      ],
      "additionalProperties": false,
      "properties": {
        "url": {
          "type": "string",
          "description": "The url to the file."
        },
        "subdirectory": {
          "type": "string",
          "description": "The relative path to the directory where the package is located."
        },
        "python": {
          "type": "string",
          "description": "The python versions for which the dependency should be installed."
        },
        "platform": {
          "type": "string",
          "description": "The platform(s) for which the dependency should be installed."
        },
        "markers": {
          "type": "string",
          "description": "The PEP 508 compliant environment markers for which the dependency should be installed."
        },
        "optional": {
          "type": "boolean",
          "description": "Whether the dependency is optional or not."
        },
        "extras": {
          "type": "array",
          "description": "The required extras for this dependency.",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "dependency-options": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "python": {
          "type": "string",
          "description": "The python versions for which the dependency should be installed."
        },
        "platform": {
          "type": "string",
          "description": "The platform(s) for which the dependency should be installed."
        },
        "markers": {
          "type": "string",
          "description": "The PEP 508 compliant environment markers for which the dependency should be installed."
        },
        "allow-prereleases": {
          "type": "boolean",
          "description": "Whether the dependency allows prereleases or not."
        },
        "source": {
          "type": "string",
          "description": "The exclusive source used to search for this dependency."
        },
        "develop": {
          "type": "boolean",
          "description": "Whether to install the dependency in development mode."
        }
      }
    },
    "multiple-constraints-dependency": {
      "type": "array",
      "minItems": 1,
      "items": {
        "oneOf": [
          {
            "$ref": "#/definitions/dependency"
          },
          {
            "$ref": "#/definitions/long-dependency"
          },
          {
            "$ref": "#/definitions/git-dependency"
          },
          {
            "$ref": "#/definitions/file-dependency"
          },
          {
            "$ref": "#/definitions/path-dependency"
          },
          {
            "$ref": "#/definitions/url-dependency"
          },
          {
            "$ref": "#/definitions/dependency-options"
          }
        ]
      }
    }
  }
}
