Skip to content

Instantly share code, notes, and snippets.

@JaseHadd
Last active November 5, 2024 20:32
Show Gist options
  • Save JaseHadd/e089d8c696d3cacb62af7c218930d752 to your computer and use it in GitHub Desktop.
Save JaseHadd/e089d8c696d3cacb62af7c218930d752 to your computer and use it in GitHub Desktop.
Foundry VTT Module Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://gist.github.com/JaseHadd/e089d8c696d3cacb62af7c218930d752/raw/fountry-vtt-module-schema.json",
"title": "Foundry VTT module.json schema",
"type": "object",
"definitions": {
"foundry-version": {
"anyOf": [
{
"type": "integer",
"minimum": 1,
"maximum": 13
},
{
"type": "string",
"pattern": "^0(\\.[1-8](\\.(0|[1-9]|10))?)?$"
},
{
"type": "string",
"pattern": "^([1-9]|1[0-3])(\\.(0|[1-9][0-9]{0,2}))?$"
}
]
},
"semver": {
"type": "string",
"pattern": "^\\d*(\\.\\d*(\\.\\d*)?)?"
},
"calver": {
"type": "string",
"anyOf": [
{
"pattern": "20\\d{2}-(0\\d|1[012])-([0-2]\\d|3[01])"
},
{
"pattern": "20\\d{2}(0\\d|1[012])([0-2]\\d|3[01])"
}
]
},
"string-array": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"pack": {
"type": "object",
"required": [
"name",
"label",
"type"
],
"if": {
"properties": {
"type": {
"enum": [
"Actor",
"Adventure",
"Item"
]
}
}
},
"then": {
"required": [
"system"
]
},
"properties": {
"name": {
"type": "string"
},
"label": {
"type": "string"
},
"type": {
"enum": [
"Actor",
"Adventure",
"Cards",
"Item",
"JournalEntry",
"Macro",
"Playlist",
"RollTable",
"Scene"
]
},
"system": {
"type": "string"
},
"path": {
"type": "string"
}
}
},
"pack-folder": {
"type": "object",
"required": [
"name",
"sorting",
"packs"
],
"properties": {
"name": {
"description": "The name of the Folder.",
"type": "string"
},
"sorting": {
"description": "How to sort the given Packs. Using m will sort it manually and a will sort alphabetically.",
"enum": [
"m",
"a"
]
},
"color": {
"type": "string",
"pattern": "^#[0-9a-f]{6}$"
},
"packs": {
"description": "The Packs from this Module that should be in this Folder.",
"$ref": "#/definitions/string-array"
},
"folders": {
"description": "An array of Folder objects with the same fields that should be within the parent Folder.",
"type": "array",
"items": {
"$ref": "#/definitions/pack-folder"
}
}
}
}
},
"required": [
"id",
"title",
"description",
"version"
],
"properties": {
"id": {
"description": "Choose a unique module 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 your module directory.",
"type": "string"
},
"title": {
"description": "Provide a human readable title for the module which is displayed as the visible name for the module in the Setup menu and elsewhere.",
"type": "string"
},
"description": {
"description": "This field can contain a more lengthy description of the module. 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.",
"type": "string"
},
"version": {
"description": "The module version number can be a number or a string which denotes the version of your module. When making changes to your module, 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.",
"type": "string"
},
"compatibility": {
"description": "the compatibility field is an object key for capturing the sub-fields which defines the limits of your module's compatibility based on Foundry Virtual Tabletop version.",
"type": "object",
"properties": {
"minimum": {
"description": "The module will not function for versions earlier than this.",
"$ref": "#/definitions/foundry-version"
},
"verified": {
"description": "The module has been verified to be compatible up to this version.",
"$ref": "#/definitions/foundry-version"
},
"maximum": {
"description": "The module will not function for newer versions than this.",
"$ref": "#/definitions/foundry-version"
}
}
},
"esmodules": {
"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.",
"$ref": "#/definitions/string-array"
},
"scripts": {
"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 module is being used. Each listed script path should be relative to the module root directory. All scripts which exist will be automatically included in the game session and loaded in their listed order.",
"$ref": "#/definitions/string-array"
},
"styles": {
"description": "You can designate an array of CSS files which should be included in the game session whenever this module is used. Each listed stylesheet path should be relative to the module root directory. All stylesheets which exist will be automatically included in the game session and loaded in their listed order.",
"$ref": "#/definitions/string-array"
},
"packs": {
"description": "Modules 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. The path field is optional and the system field only needs to be filled out for system-specific packs like Actors and Items.",
"type": "array",
"items": {
"$ref": "#/definitions/pack"
}
},
"packFolders": {
"description": "Compendium Packs can also be organized into Folders in the Compendium tab of the sidebar.",
"type": "array",
"items": {
"$ref": "#/definitions/pack-folder"
}
},
"relationships": {
"description": "Modules can require other modules, systems, or worlds be installed to allow their use. If a module has been installed with dependencies, but its dependencies are missing, it cannot be enabled.",
"type": "array",
"items": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"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": "string"
},
"type": {
"description": "The type attribute instructs FVTT 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.",
"enum": [
"module",
"system",
"world"
]
},
"manifest": {
"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.",
"type": "string"
},
"compatibility": {
"type": "object",
"properties": {
"minimum": {
"anyOf": [
{
"$ref": "#/definitions/semver"
},
{
"$ref": "#/definitions/calver"
}
]
},
"verified": {
"anyOf": [
{
"$ref": "#/definitions/semver"
},
{
"$ref": "#/definitions/calver"
}
]
},
"maximum": {
"anyOf": [
{
"$ref": "#/definitions/semver"
},
{
"$ref": "#/definitions/calver"
}
]
}
}
}
}
}
},
"languages": {
"description": "A module may designate an array of languages specifications that it supports by default. Each element in the languages array is an object which defines the language tag, label, and path to its localization file.",
"type": "array",
"items": {
"type": "object",
"properties": {
"lang": {
"description": "A language code in lower-case letters, for example \"en\" for English.",
"type": "string",
"minLength": 2,
"maxLength": 3
},
"name": {
"description": "The formal and readable name for the language, for example \"English\".",
"type": "string",
"minLength": 1
},
"path": {
"description": "A path relative to the root directory of the manifest where localization strings are provided in JSON format.",
"type": "string",
"minLength": 1
}
}
}
},
"system": {
"description": "An array of package names used as a restriction to prevent activation of a module for systems that the module does not support.",
"$ref": "#/definitions/string-array"
},
"authors": {
"description": "An array listing each author as an object that can contain the keys name, email, discord, and url.",
"type": "array",
"items": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
},
"discord": {
"type": "string"
},
"email": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
},
"socket": {
"description": "A module may request for a specialized socket namespace to be provided which allows data messages to be passed between connected clients. If set to true, a socket event will be handled by the server with the event name module.{name}. This event name relays arbitrary data packets between the sending client and all other connected clients.",
"type": "boolean"
},
"url": {
"description": "A public URL that links to the repository or documentation pages for the module. This link will be displayed for users to allow them to find more information about your system. If your module is hosted in version control like GitHub or GitLab, linking to the repository in this field is a good choice.",
"type": "string"
},
"manifest": {
"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 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.",
"type": "string"
},
"download": {
"description": "A public URL that provides a zip archive of the module 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.",
"type": "string"
},
"license": {
"description": "A path to a license file relative to the root module folder or a publicly accessible URL which contains the software license that applies to this package.",
"type": "string"
},
"readme": {
"description": "A path to a read-me file relative to the root module folder or a publicly accessible URL which contains instructions or information about the package..",
"type": "string"
},
"bugs": {
"description": "A publicly accessible URL where issues, suggestions, and bug reports may be filed.",
"type": "string"
},
"changelog": {
"description": "A publicly accessible URL where update and release notes about the package may be found.",
"type": "string"
},
"library": {
"description": "The library field is a boolean that indicates whether the package is a library intended for other packages to depend on and consume. This field should be true if your package does not present any user-facing features, but rather provides functionality for other packages to utilize and rely upon. Packages with this field set to true may be hidden from third party package lists to avoid confusing users.",
"type": "boolean",
"default": false
},
"media": {
"description": "An array of objects composed of a type, url, and thumbnail that can contain art that Foundry uses in places like the Setup screen for a Package's background image.",
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"url",
"thumbnail"
],
"properties": {
"type": {
"type": "string"
},
"url": {
"type": "string"
},
"thumbnail": {
"type": "string"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment