{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "name": "Package",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "package-mode": {
      "type": "boolean",
      "default": true,
      "description": "Whether Poetry is operated in package mode or non-package mode."
    },
    "name": {
      "type": "string",
      "description": "Package name (legacy)."
    },
    "version": {
      "type": "string",
      "description": "Package version (legacy)."
    },
    "description": {
      "type": "string",
      "description": "Short package description (legacy).",
      "pattern": "\\A[^\\n]*\\Z"
    },
    "keywords": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "A tag/keyword that this package relates to (legacy)."
      }
    },
    "homepage": {
      "type": "string",
      "description": "Homepage URL for the project (legacy).",
      "format": "uri"
    },
    "repository": {
      "type": "string",
      "description": "Repository URL for the project (legacy).",
      "format": "uri"
    },
    "documentation": {
      "type": "string",
      "description": "Documentation URL for the project (legacy).",
      "format": "uri"
    },
    "license": {
      "type": "string",
      "description": "License name (legacy)."
    },
    "authors": {
      "$ref": "#/definitions/authors",
      "description": "Authors (legacy)."
    },
    "maintainers": {
      "$ref": "#/definitions/maintainers",
      "description": "Maintainers (legacy)."
    },
    "readme": {
      "anyOf": [
        {
          "type": "string",
          "description": "The path to the README file (legacy)."
        },
        {
          "type": "array",
          "description": "A list of paths to the readme files.",
          "items": {
            "type": "string"
          }
        }
      ]
    },
    "classifiers": {
      "type": "array",
      "description": "A list of trove classifiers (legacy)."
    },
    "packages": {
      "type": "array",
      "description": "A list of packages to include in the final distribution.",
      "items": {
        "type": "object",
        "description": "Information about where the package resides.",
        "additionalProperties": false,
        "required": [
          "include"
        ],
        "properties": {
          "include": {
            "$ref": "#/definitions/include-path"
          },
          "from": {
            "type": "string",
            "description": "Where the source directory of the package resides."
          },
          "format": {
            "$ref": "#/definitions/package-formats"
          },
          "to": {
            "type": "string",
            "description": "Where the package should be installed in the final distribution."
          }
        }
      }
    },
    "include": {
      "type": "array",
      "description": "A list of files and folders to include.",
      "items": {
        "anyOf": [
          {
            "$ref": "#/definitions/include-path"
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "path"
            ],
            "properties": {
              "path": {
                "$ref": "#/definitions/include-path"
              },
              "format": {
                "$ref": "#/definitions/package-formats"
              }
            }
          }
        ]
      }
    },
    "exclude": {
      "type": "array",
      "description": "A list of files and folders to exclude."
    },
    "dependencies": {
      "type": "object",
      "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
      "properties": {
        "python": {
          "type": "string",
          "description": "The Python versions the package is compatible with."
        }
      },
      "$ref": "#/definitions/dependencies",
      "additionalProperties": false
    },
    "dev-dependencies": {
      "type": "object",
      "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
      "$ref": "#/definitions/dependencies",
      "additionalProperties": false
    },
    "extras": {
      "type": "object",
      "description": "Extras (legacy).",
      "patternProperties": {
        "^[a-zA-Z-_.0-9]+$": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-zA-Z-_.0-9]+$"
          }
        }
      }
    },
    "group": {
      "type": "object",
      "description": "This represents groups of dependencies",
      "patternProperties": {
        "^[a-zA-Z-_.0-9]+$": {
          "type": "object",
          "description": "This represents a single dependency group",
          "anyOf": [
            {
              "required": [
                "dependencies"
              ]
            },
            {
              "required": [
                "include-groups"
              ]
            },
            {
              "required": [
                "optional"
              ]
            }
          ],
          "properties": {
            "optional": {
              "type": "boolean",
              "description": "Whether the dependency group is optional or not"
            },
            "include-groups": {
              "type": "array",
              "description": "List of dependency group names included in this group.",
              "items": {
                "type": "string"
              }
            },
            "dependencies": {
              "type": "object",
              "description": "The dependencies of this dependency group",
              "$ref": "#/definitions/dependencies",
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        }
      }
    },
    "build": {
      "$ref": "#/definitions/build-section"
    },
    "scripts": {
      "type": "object",
      "description": "A hash of scripts to be installed.",
      "patternProperties": {
        "^[a-zA-Z-_.0-9]+$": {
          "oneOf": [
            {
              "$ref": "#/definitions/script-legacy"
            },
            {
              "$ref": "#/definitions/script-table"
            }
          ]
        }
      }
    },
    "plugins": {
      "type": "object",
      "description": "A hash of hashes representing plugins",
      "patternProperties": {
        "^[a-zA-Z-_.0-9]+$": {
          "type": "object",
          "patternProperties": {
            "^[a-zA-Z-_.0-9]+$": {
              "type": "string"
            }
          }
        }
      }
    },
    "urls": {
      "type": "object",
      "patternProperties": {
        "^.+$": {
          "type": "string",
          "description": "The full url of the custom url (Legacy)."
        }
      }
    }
  },
  "definitions": {
    "authors": {
      "type": "array",
      "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list (legacy).",
      "items": {
        "type": "string"
      }
    },
    "maintainers": {
      "type": "array",
      "description": "List of maintainers, other than the original author(s), that upkeep the package (legacy).",
      "items": {
        "type": "string"
      }
    },
    "include-path": {
      "type": "string",
      "description": "Path to file or directory to include."
    },
    "package-format": {
      "type": "string",
      "enum": [
        "sdist",
        "wheel"
      ],
      "description": "A Python packaging format."
    },
    "package-formats": {
      "oneOf": [
        {
          "$ref": "#/definitions/package-format"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/definitions/package-format"
          }
        }
      ],
      "description": "The format(s) for which the package must be included."
    },
    "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"
          }
        ]
      }
    },
    "script-table": {
      "type": "object",
      "oneOf": [
        {
          "$ref": "#/definitions/extra-script-legacy"
        },
        {
          "$ref": "#/definitions/extra-scripts"
        }
      ]
    },
    "script-legacy": {
      "type": "string",
      "description": "A simple script pointing to a callable object."
    },
    "extra-scripts": {
      "type": "object",
      "description": "Either a console entry point or a script file that'll be included in the distribution package.",
      "additionalProperties": false,
      "properties": {
        "reference": {
          "type": "string",
          "description": "If type is file this is the relative path of the script file, if console it is the module name."
        },
        "type": {
          "description": "Value can be either file or console.",
          "type": "string",
          "enum": [
            "file",
            "console"
          ]
        },
        "extras": {
          "type": "array",
          "description": "The required extras for this script. Only applicable if type is console.",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "reference",
        "type"
      ]
    },
    "extra-script-legacy": {
      "type": "object",
      "description": "A script that should be installed only if extras are activated.",
      "additionalProperties": false,
      "properties": {
        "callable": {
          "$ref": "#/definitions/script-legacy",
          "description": "The entry point of the script. Deprecated in favour of reference."
        },
        "extras": {
          "type": "array",
          "description": "The required extras for this script.",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "build-script": {
      "type": "string",
      "description": "The python script file used to build extensions."
    },
    "build-config": {
      "type": "object",
      "description": "Build specific configurations.",
      "additionalProperties": false,
      "properties": {
        "generate-setup-file": {
          "type": "boolean",
          "description": "Generate and include a setup.py file in sdist.",
          "default": false
        },
        "script": {
          "$ref": "#/definitions/build-script"
        }
      }
    },
    "build-section": {
      "oneOf": [
        {
          "$ref": "#/definitions/build-script"
        },
        {
          "$ref": "#/definitions/build-config"
        }
      ]
    }
  }
}
