{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/foundry-vtt-base-package-manifest/latest.json",
  "title": "JSON schema for Foundry VTT manifest files - module.json, system.json, or world.json.  This is the base from which others inherit.",
  "x-lintel": {
    "source": "https://www.schemastore.org/foundryvtt-base-package-manifest.json",
    "sourceSha256": "80715f977b7ed68f73677691be710203ca2dcbb5045f8011ba9bbfeb919cbbc7"
  },
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/Identifier",
      "description": "Choose a unique package identifier. This must be an all lower-case string with no special characters and should use hyphens (not underscores) to separate multiple terms. This name must match exactly with the name of the parent directory within which you create the package."
    },
    "name": {
      "$ref": "#/$defs/Identifier",
      "deprecated": true,
      "deprecationMessage": "Use id instead. Deprecated since V10."
    },
    "title": {
      "$ref": "#/$defs/NonBlankString",
      "description": "Provide a human readable title for the package which is displayed as the visible name for the package in the Setup menu and elsewhere.",
      "examples": [
        "Simple World-Building",
        "Unfulfilled Rolls"
      ]
    },
    "description": {
      "description": "This field can contain a more lengthy description of the package. This text can be used to describe the functionality, list contact information, provide recommendations to contributors or testers, or any other information you feel is important to provide. This field can contain HTML to structure and style your text. For a system, this is also a good place to include any special licensing or attribution information that you need to distribute.",
      "type": "string",
      "examples": [
        "A minimalist game system which provides configurable Actor and Item templates to support free-form system agnostic game-play.",
        "<p>A module to integrate <a href=\"https://worldanvil.com\" title=\"World Anvil\" target=\"_blank\">World Anvil</a> with Foundry Virtual Tabletop.</p>"
      ]
    },
    "author": {
      "$ref": "#/$defs/NonBlankString",
      "deprecated": true,
      "deprecationMessage": "Use authors instead. Deprecated since V10."
    },
    "authors": {
      "description": "An array listing each author as an object that contains a name and potentially some contact details.",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "$ref": "#/$defs/NonBlankString",
            "description": "The only required field for an author.  This can be your username, your full name, etc."
          },
          "email": {
            "$ref": "#/$defs/NonBlankString",
            "examples": [
              "email@example.com"
            ]
          },
          "url": {
            "$ref": "#/$defs/URL",
            "examples": [
              "https://website.com/of/the/author"
            ]
          },
          "discord": {
            "type": "string",
            "pattern": "^.+#\\d+$|^[a-z0-9._]+$",
            "examples": [
              "oldDiscordID#0001",
              "new_2023_discord_id"
            ]
          },
          "flags": {
            "$ref": "#/$defs/Flags"
          },
          "ko-fi": {
            "$ref": "#/$defs/NonBlankString",
            "description": "(Manifest+ field)",
            "examples": [
              "kofiName"
            ]
          },
          "patreon": {
            "$ref": "#/$defs/NonBlankString",
            "description": "(Manifest+ field)",
            "examples": [
              "patreonName"
            ]
          },
          "reddit": {
            "$ref": "#/$defs/NonBlankString",
            "description": "(Manifest+ field)",
            "examples": [
              "u/RedditUsername"
            ]
          },
          "twitter": {
            "$ref": "#/$defs/NonBlankString",
            "description": "(Manifest+ field)",
            "examples": [
              "@TwitterHandle"
            ]
          }
        },
        "additionalProperties": false
      }
    },
    "url": {
      "$ref": "#/$defs/URL",
      "description": "A public URL that links to the repository or documentation pages for the package. This link will be displayed for users to allow them to find more information about your package. If your package is hosted in version control like GitHub or GitLab, linking to the repository in this field is a good choice.",
      "examples": [
        "https://github.com/foundryvtt/world-anvil",
        "https://gitlab.com/foundrynet/worldbuilding"
      ]
    },
    "license": {
      "description": "A path to a license file relative to the root package folder or a publicly accessible URL which contains the software license that applies to this package.",
      "examples": [
        "LICENSE.txt"
      ],
      "anyOf": [
        {
          "$ref": "#/$defs/URL"
        },
        {
          "$ref": "#/$defs/File"
        }
      ]
    },
    "readme": {
      "description": "A path to a read-me file relative to the root package folder or a publicly accessible URL which contains instructions or information about the package.",
      "examples": [
        "https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/blob/master/README.md"
      ],
      "anyOf": [
        {
          "$ref": "#/$defs/URL"
        },
        {
          "$ref": "#/$defs/File"
        }
      ]
    },
    "bugs": {
      "$ref": "#/$defs/URL",
      "description": "A publicly accessible URL where issues, suggestions, and bug reports may be filed.",
      "examples": [
        "https://github.com/foundryvtt/pf2e/issues"
      ]
    },
    "changelog": {
      "$ref": "#/$defs/URL",
      "description": "A publicly accessible URL where update and release notes about the package may be found.",
      "examples": [
        "https://github.com/shemetz/pf2e-modifiers-matter/blob/master/Changelog.md"
      ]
    },
    "flags": {
      "$ref": "#/$defs/Flags"
    },
    "media": {
      "type": "array",
      "description": "(undocumented, intended to be used by core Foundry in the future)",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/$defs/NonBlankString"
          },
          "url": {
            "$ref": "#/$defs/URL"
          },
          "caption": {
            "$ref": "#/$defs/NonBlankString"
          },
          "loop": {
            "type": "boolean",
            "default": false
          },
          "thumbnail": {
            "$ref": "#/$defs/NonBlankString"
          },
          "flags": {
            "$ref": "#/$defs/Flags"
          }
        }
      }
    },
    "version": {
      "$ref": "#/$defs/Version",
      "description": "The package version number can be a number or a string which denotes the version of your module/system/world. When making changes to your package, incrementing the version number in your manifest file is used to signal to users that an update is available. We discuss some supported options for versioning in the Introduction to Development article."
    },
    "compatibility": {
      "$ref": "#/$defs/PackageCompatibility",
      "description": "The compatibility field is an object key for capturing the sub-fields which defines the limits of your package's compatibility based on Foundry Virtual Tabletop version."
    },
    "minimumCoreVersion": {
      "$ref": "#/$defs/Version",
      "deprecated": true,
      "deprecationMessage": "Use compatibility.minimum instead. Deprecated since V10."
    },
    "compatibleCoreVersion": {
      "$ref": "#/$defs/Version",
      "deprecated": true,
      "deprecationMessage": "Use compatibility.verified instead. Deprecated since V10."
    },
    "scripts": {
      "$ref": "#/$defs/FileArray",
      "description": "A less common way of including Javascript with the increasing adoption of ESModules, this field allows you to define an array of JavaScript file paths which should be included whenever this package is being used. Each listed script path should be relative to the package root directory. All scripts which exist will be automatically included in the game session and loaded in their listed order."
    },
    "esmodules": {
      "$ref": "#/$defs/FileArray",
      "description": "The preferred method for including Javascript with your project. This field allows you to define an array of JS files which use the newer ES6 modules specification. As with scripts, this should be declared as an array. These files are identified separately in the manifest so they may be correctly loaded as a module rather than a script."
    },
    "styles": {
      "$ref": "#/$defs/FileArray",
      "description": "You can designate an array of CSS files which should be included in the game session whenever this package is used. Each listed stylesheet path should be relative to the package root directory. All stylesheets which exist will be automatically included in the game session and loaded in their listed order."
    },
    "languages": {
      "description": "A list of localization files that Foundry can use to translate strings.",
      "type": "array",
      "items": {
        "description": "The language definition",
        "type": "object",
        "required": [
          "lang",
          "path"
        ],
        "properties": {
          "lang": {
            "$ref": "#/$defs/NonBlankString",
            "description": "A language code in lower-case letters, for example \"en\" for English. See <https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes>",
            "examples": [
              "en",
              "fr",
              "de",
              "zh-tw"
            ]
          },
          "name": {
            "$ref": "#/$defs/NonBlankString",
            "description": "The formal and readable name for the language, for example \"English\".",
            "examples": [
              "English",
              "Français",
              "Deutsch",
              "简体中文（Simplified Chinese）"
            ]
          },
          "path": {
            "$ref": "#/$defs/File",
            "description": "A path relative to the root directory of the manifest where localization strings are provided in JSON format."
          },
          "system": {
            "$ref": "#/$defs/Identifier",
            "description": "(undocumented)"
          },
          "module": {
            "$ref": "#/$defs/Identifier",
            "description": "(undocumented)"
          },
          "flags": {
            "$ref": "#/$defs/Flags"
          }
        },
        "additionalProperties": false
      }
    },
    "packs": {
      "description": "Packages may come bundled with Compendium packs which include game content for various Document types. Compendium packs are defined as objects which have their own internal metadata structure.",
      "type": "array",
      "items": {
        "description": "The definition of a Compendium pack.",
        "type": "object",
        "required": [
          "name",
          "label",
          "path",
          "type"
        ],
        "properties": {
          "name": {
            "$ref": "#/$defs/Identifier",
            "description": "Name of the Compendium pack. This should be a lowercase string with no special characters other than hyphens.",
            "examples": [
              "abomination-vaults-bestiary",
              "fxmaster"
            ]
          },
          "label": {
            "$ref": "#/$defs/NonBlankString",
            "description": "Human readable label of the Compendium pack. This is displayed in the Compendium sidebar.",
            "examples": [
              "TokenMagic Portfolio",
              "Premade Items"
            ]
          },
          "path": {
            "$ref": "#/$defs/File",
            "description": "The relative path to the Compendium .db file. Best practice is to put these in the /packs subdirectory. Required until V11; afterwards, can be omitted if pack resides in `package-id/packs/`."
          },
          "private": {
            "description": "(undocumented, will hide pack from non-GMs)",
            "type": "boolean"
          },
          "type": {
            "description": "Each Compendium pack must designate which type of Entity it contains.",
            "type": "string",
            "enum": [
              "Actor",
              "Cards",
              "Adventure",
              "Item",
              "Journal",
              "JournalEntry",
              "Macro",
              "Playlist",
              "RollTable",
              "Table",
              "Scene"
            ]
          },
          "entity": {
            "deprecated": true,
            "deprecationMessage": "Use type instead. Deprecated since V9.",
            "type": "string"
          },
          "system": {
            "description": "The id of the system/s the Compendium pack is created for. This ensures Foundry knows this Compendium only works for that system. This may be a string or an array of strings. Important: Actor, Item, and Adventure compendium packs MUST define a system field.",
            "oneOf": [
              {
                "$ref": "#/$defs/Identifier"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/Identifier"
                }
              }
            ]
          },
          "flags": {
            "$ref": "#/$defs/Flags"
          }
        },
        "additionalProperties": false
      }
    },
    "relationships": {
      "description": "Packages can require modules, systems, or worlds be installed to allow their use. If a package has been installed with dependencies, but its dependencies are missing, it cannot be enabled.",
      "type": "object",
      "properties": {
        "systems": {
          "description": "Will only allow the package to activated within Worlds which are running one of these systems and with a compatible version.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/PackageRelationship"
          }
        },
        "requires": {
          "description": "If a package has been installed with dependencies, but its dependencies are missing, it cannot be enabled.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/PackageRelationship"
          }
        },
        "recommends": {
          "description": "(undocumented, intended to be used by core Foundry in the future)",
          "type": "array",
          "items": {
            "$ref": "#/$defs/PackageRelationship"
          }
        },
        "conflicts": {
          "description": "(undocumented, intended to be used by core Foundry in the future)",
          "type": "array",
          "items": {
            "$ref": "#/$defs/PackageRelationship"
          }
        }
      },
      "additionalProperties": false
    },
    "dependencies": {
      "deprecated": true,
      "deprecationMessage": "Use relationships instead. Deprecated since V10.",
      "type": "array",
      "items": {
        "description": "The definition of a dependency package.",
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/$defs/Identifier",
            "description": "ID of the package this package depends on."
          },
          "name": {
            "$ref": "#/$defs/Identifier",
            "description": "ID of the package this package depends on."
          },
          "type": {
            "description": "The type of dependency.",
            "type": "string",
            "default": "module",
            "enum": [
              "module",
              "system",
              "world"
            ]
          },
          "manifest": {
            "$ref": "#/$defs/URL",
            "description": "Provides an explicit URL to the dependency's manifest to be able to install the package. If not provided, Foundry will check the website package list."
          }
        },
        "additionalProperties": false
      }
    },
    "system": {
      "deprecated": true,
      "deprecationMessage": "Use relationships instead. Deprecated since V10.",
      "type": "string"
    },
    "socket": {
      "description": "A package may request for a specialized socket namespace to be provided. If set to true, a socket event will be handled by the server with the name `system.${id}` (for a system) or `module.${id}` (for a module), and will transact a arbitrary data object by broadcasting that data to all connected clients. This allows the package to have a reserved channel for messaging events which are needed to coordinate actions across multiple connected clients.",
      "type": "boolean"
    },
    "manifest": {
      "$ref": "#/$defs/URL",
      "description": "A stable URL that describes the latest release version of your manifest file. This URL is used for automatic system installation in the Foundry VTT setup screen. This manifest URL is consulted during the system/module update check to see whether a new version is available for download. It is important that this address remain stable, otherwise updates will not be detected.",
      "examples": [
        "https://raw.githubusercontent.com/foundryvtt/worldbuilding/master/system.json",
        "https://gitlab.com/tposney/dae/raw/master/package/module.json"
      ]
    },
    "download": {
      "$ref": "#/$defs/URL",
      "description": "A public URL that provides a zip archive of the package for the manifest version which points to it. The archive at this URL is retrieved during the installation or update process. If you are using version control for your package - it is recommended to manage download archives using the tags and releases features which are supported by most git repositories.",
      "examples": [
        "https://github.com/foundryvtt/worldbuilding/archive/refs/tags/release-072.zip",
        "https://gitlab.com/tposney/dae/raw/master/package/dae-v0.10.32.zip",
        "https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/jobs/artifacts/4.6.7/raw/dist/dice-so-nice.zip?job=build"
      ]
    },
    "protected": {
      "description": "(undocumented, used for premium packages)",
      "type": "boolean",
      "default": false
    },
    "exclusive": {
      "description": "(undocumented)",
      "type": "boolean"
    },
    "persistentStorage": {
      "description": "(undocumented, intended to be used by core Foundry in the future)",
      "type": "boolean"
    },
    "documentTypes": {
      "description": "(intended to be used by core Foundry in the future, see Module Sub-Types article)",
      "type": "object"
    },
    "manifestPlusVersion": {
      "$ref": "#/$defs/Version",
      "description": "(Manifest+ field)",
      "examples": [
        "1.2.0"
      ]
    },
    "includes": {
      "description": "(Manifest+ field)",
      "type": "array"
    },
    "deprecated": {
      "description": "(Manifest+ field)",
      "type": "object"
    },
    "conflicts": {
      "description": "(Manifest+ field)",
      "type": "object"
    }
  },
  "required": [
    "id",
    "title",
    "description",
    "version"
  ],
  "$defs": {
    "Identifier": {
      "type": "string",
      "format": "regex",
      "pattern": "^[a-zA-Z0-9_-]+$",
      "examples": [
        "lib-wrapper",
        "dnd5e"
      ]
    },
    "File": {
      "type": "string",
      "description": "Relative path to a file, case sensitive.",
      "format": "uri-reference",
      "examples": [
        "src/main.mjs",
        "lang/en.json",
        "packs/loot.db"
      ]
    },
    "FileArray": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/File"
      },
      "uniqueItems": true,
      "default": []
    },
    "URL": {
      "type": "string",
      "format": "uri",
      "pattern": "^https?://[^.\\s]+\\.[^.\\s]",
      "description": "A public URL.",
      "examples": [
        "https://example.com",
        "https://raw.githubusercontent.com/foundryvtt/worldbuilding/master/system.json"
      ]
    },
    "Version": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        }
      ],
      "examples": [
        "1.0.0",
        "0.5.0-beta",
        "1.0",
        "9.361",
        "2023-04-08",
        "20220312"
      ]
    },
    "NonBlankString": {
      "type": "string",
      "pattern": ".+"
    },
    "Flags": {
      "type": "object",
      "description": "Flag data."
    },
    "PackageCompatibility": {
      "type": "object",
      "properties": {
        "minimum": {
          "$ref": "#/$defs/Version",
          "description": "The module will not function for versions earlier than this."
        },
        "verified": {
          "$ref": "#/$defs/Version",
          "description": "The module has been verified to be compatible up to this version."
        },
        "maximum": {
          "$ref": "#/$defs/Version",
          "description": "The module will not function for newer versions than this."
        }
      },
      "additionalProperties": false
    },
    "PackageRelationship": {
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/Identifier",
          "description": "Dependency entries require the id attribute. If only an id is provided, additional details about the module will be discovered from the Foundry VTT website listing."
        },
        "type": {
          "description": "The type attribute instructs FoundryVTT that the dependency may be on a different type of package. By default dependencies are assumed to be a module, so if you want to depend on a system or world you should be explicit.",
          "type": "string",
          "default": "module",
          "enum": [
            "module",
            "system",
            "world"
          ]
        },
        "manifest": {
          "$ref": "#/$defs/URL",
          "description": "The manifest attribute provides an explicit manifest url to be used for downloading the dependency. If a manifest is not provided, the dependency package must exist in the Foundry website directory."
        },
        "compatibility": {
          "$ref": "#/$defs/PackageCompatibility",
          "description": "As above, the compatibility of a dependency can be defined, ensuring that the dependency will not be installed if it does not meet the defined requirements."
        },
        "reason": {
          "$ref": "#/$defs/NonBlankString",
          "description": "(undocumented, intended to be used by core Foundry in the future)"
        },
        "flags": {
          "$ref": "#/$defs/Flags"
        }
      },
      "additionalProperties": false
    }
  }
}
