Last active
December 29, 2018 01:05
-
-
Save 3TUSK/1a2dfb565bff525c178daaebcc8e1265 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"$id": "http://example.com/root.json", | |
"type": "object", | |
"title": "Fabric Mod JSON Metadata Schema", | |
"description": "Schema used for validation of Fabric Mod's `mod.json` file.", | |
"required": [ | |
"id", | |
"version" | |
], | |
"oneOf": [ | |
{ | |
"required": [ "initializer" ], | |
"not": { | |
"required": [ "initializers" ] | |
} | |
}, | |
{ | |
"required": [ "initializers" ], | |
"not": { | |
"required": [ "initializer" ] | |
} | |
}, | |
{ | |
"not": { | |
"required": [ "initializer", "initializers" ] | |
} | |
} | |
], | |
"properties": { | |
"id": { | |
"$id": "#/properties/id", | |
"type": "string", | |
"title": "Mod ID Schema", | |
"description": "Validates Mod ID", | |
"examples": [ | |
"my_mod_id" | |
], | |
"pattern": "^([a-z][a-z0-9-_]{1,63})$" | |
}, | |
"version": { | |
"$id": "#/properties/version", | |
"title": "Version Schema", | |
"description": "Validates version string", | |
"$ref": "#/definitions/version-string" | |
}, | |
"requires": { | |
"$id": "#/properties/requires", | |
"title": "Requirement List Schema", | |
"description": "Validates declared dependencies list", | |
"$ref": "#/definitions/dependencies" | |
}, | |
"conflicts": { | |
"$id": "#/properties/conflicts", | |
"title": "Conflicts Schema", | |
"description": "Validates declared incompatiblities list", | |
"$ref": "#/definitions/dependencies" | |
}, | |
"languageAdapter": { | |
"$id": "#/properties/languageAdapter", | |
"title": "Language Adapter Schema", | |
"description": "Validates declared canonical name of Language Adapter", | |
"$ref": "#/definitions/class-name" | |
}, | |
"mixins": { | |
"$id": "#/properties/mixins", | |
"type": "object", | |
"title": "Mixins Schema", | |
"description": "Validates declared mixin properties", | |
"required": [], | |
"properties": { | |
"client": { | |
"$id": "#/properties/mixins/properties/client", | |
"type": "string", | |
"title": "Client-Side-Mixin Schema", | |
"description": "Validates the name of mixin config used on client", | |
"examples": ["client.json"], | |
"pattern": "^(.*)$" | |
}, | |
"server": { | |
"$id": "#/properties/mixins/properties/server", | |
"type": "string", | |
"title": "Server-Side-Mixin Schema", | |
"description": "Validates the name of mixin config used on server", | |
"examples": [ | |
"server.json" | |
], | |
"pattern": "^(.*)$" | |
}, | |
"common": { | |
"$id": "#/properties/mixins/properties/common", | |
"type": "string", | |
"title": "Common-Mixin Schema", | |
"description": "Validates the name of mixin config used on both side", | |
"examples": [ | |
"common.json" | |
], | |
"pattern": "^(.*)$" | |
} | |
} | |
}, | |
"side": { | |
"$id": "#/properties/side", | |
"type": "string", | |
"enum": [ | |
"client", | |
"server", | |
"universal" | |
], | |
"title": "Side Schema", | |
"description": "Vadliates sideness", | |
"default": "universal", | |
"examples": ["client", "server", "universal"], | |
"pattern": "^(client|server|universal)$" | |
}, | |
"lazilyLoaded": { | |
"$id": "#/properties/lazilyLoaded", | |
"type": "boolean", | |
"title": "Lazily-Loaded Schema", | |
"description": "Vadliates the lazy-loading property", | |
"default": false, | |
"examples": [true, false] | |
}, | |
"initializer": { | |
"$id": "#/properties/initializer", | |
"title": "Initializer Schema", | |
"description": "Validates entry point of initializers", | |
"$ref": "#/definitions/class-name" | |
}, | |
"initializers": { | |
"$id": "#/properties/initializer", | |
"type": "array", | |
"title": "Initializer Schema", | |
"description": "Validates entry point of initializers", | |
"items": { | |
"$ref": "#/definitions/class-name" | |
} | |
}, | |
"name": { | |
"$id": "#/properties/name", | |
"type": "string", | |
"title": "Name Schema", | |
"description": "Validates the human-readable name of Mod", | |
"default": "", | |
"examples": ["My Mod"], | |
"pattern": "^(.+)$" | |
}, | |
"description": { | |
"$id": "#/properties/description", | |
"type": "string", | |
"title": "Description Schema", | |
"description": "Validate description of said mod", | |
"default": "", | |
"examples": ["Lorem ipsum"], | |
"pattern": "^(.*)$" | |
}, | |
"links": { | |
"$id": "#/properties/links", | |
"title": "Link Schema", | |
"description": "Validates all provided URIs that relates to the mod", | |
"oneOf": [ | |
{ | |
"type": "string", | |
"format": "uri", | |
"examples": [ "http://example.com" ] | |
}, | |
{ | |
"type": "object", | |
"required": [], | |
"properties": { | |
"homepage": { | |
"type": "string", | |
"format": "uri", | |
"examples": [ "http://example.com" ] | |
}, | |
"issues": { | |
"type": "string", | |
"format": "uri", | |
"examples": [ "http://example.com" ] | |
}, | |
"sources": { | |
"type": "string", | |
"format": "uri", | |
"examples": [ "http://example.com" ] | |
} | |
} | |
} | |
] | |
}, | |
"recommends": { | |
"$id": "#/properties/recommends", | |
"title": "Recommended Dependencies Schema", | |
"description": "Validates recommened dependencies list", | |
"$ref": "#/definitions/dependencies" | |
}, | |
"authors": { | |
"$id": "#/properties/authors", | |
"type": "array", | |
"title": "Author List Schema", | |
"description": "Validates author list", | |
"items": { | |
"$ref": "#/definitions/person" | |
} | |
}, | |
"contributors": { | |
"$id": "#/properties/contributors", | |
"type": "array", | |
"title": "Contributor List Schema", | |
"description": "Validates contributor list", | |
"items": { | |
"$ref": "#/definitions/person" | |
} | |
}, | |
"license": { | |
"$id": "#/properties/license", | |
"type": "string", | |
"title": "License Schema", | |
"description": "Validates license name", | |
"default": "", | |
"examples": [ | |
"Thonkery Public License" | |
], | |
"pattern": "^(.*)$" | |
} | |
}, | |
"definitions": { | |
"version-string": { | |
"type": "string", | |
"pattern": "^(.+)$" | |
}, | |
"class-name": { | |
"type": "string", | |
"pattern": "^([^0-9](?:\\.[^0-9])+)$" | |
}, | |
"person": { | |
"type": "string", | |
"pattern": "^.+$" | |
}, | |
"dependencies": { | |
"type": "object", | |
"patternProperties": { | |
"^([^A-Z]+)$": { | |
"oneOf": [{ | |
"$ref": "#/definitions/version-string" | |
}, | |
{ | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/version-string" | |
} | |
}, | |
{ | |
"type": "object", | |
"required": ["version", "side"], | |
"properties": { | |
"version": { | |
"$ref": "#/definitions/version-string" | |
}, | |
"side": { | |
"type": "string", | |
"enum": ["client", "server", "universal"] | |
} | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment