diff --git a/apps/schema-server/schemas/metadata/1.15.json b/apps/schema-server/schemas/metadata/1.15.json new file mode 100644 index 0000000..78e862e --- /dev/null +++ b/apps/schema-server/schemas/metadata/1.15.json @@ -0,0 +1,256 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "https://schemas.premid.app/metadata/1.15", + "title": "Metadata", + "type": "object", + "description": "Metadata that describes a activity.", + "definitions": { + "user": { + "type": "object", + "description": "User information.", + "properties": { + "name": { + "type": "string", + "description": "The name of the user." + }, + "id": { + "type": "string", + "description": "The Discord snowflake of the user.", + "pattern": "^\\d+$" + } + }, + "additionalProperties": false, + "required": [ + "name", + "id" + ] + } + }, + "properties": { + "$schema": { + "$comment": "This is required otherwise the schema will fail itself when it is applied to a document via $schema. This is optional so that validators that use this schema don't fail if the metadata doesn't have the $schema property.", + "type": "string", + "description": "The metadata schema URL." + }, + "author": { + "$ref": "#/definitions/user", + "description": "The author of this activity." + }, + "contributors": { + "type": "array", + "description": "Any extra contributors to this activity.", + "items": { + "$ref": "#/definitions/user" + } + }, + "service": { + "type": "string", + "description": "The service this activity is for." + }, + "altnames": { + "type": "array", + "description": "Alternative names for the service.", + "items": { + "type": "string", + "description": "An alternative name." + }, + "minItems": 1 + }, + "description": { + "type": "object", + "description": "A description of the activity in multiple languages.", + "propertyNames": { + "type": "string", + "description": "The language key. The key must be languagecode(-regioncode).", + "pattern": "^[a-z]{2,3}(?:-(?:[a-z]{2}|[0-9]{1,3}))?$" + }, + "patternProperties": { + "^[a-z]{2,3}(?:-(?:[a-z]{2}|[0-9]{1,3}))?$": { + "type": "string", + "description": "The description of the activity in the key's language." + } + }, + "additionalProperties": false, + "required": [ + "en" + ] + }, + "url": { + "type": [ + "string", + "array" + ], + "description": "The service's website URL, or an array of URLs. Protocols should not be added.", + "pattern": "^(([a-z0-9-]+\\.)*[0-9a-z_-]+(\\.[a-z]+)+|(\\d{1,3}\\.){3}\\d{1,3}|localhost)$", + "items": { + "type": "string", + "description": "One of the service's website URLs.", + "pattern": "^(([a-z0-9-]+\\.)*[0-9a-z_-]+(\\.[a-z]+)+|(\\d{1,3}\\.){3}\\d{1,3}|localhost)$" + }, + "minItems": 2 + }, + "version": { + "type": "string", + "description": "The SemVer version of the activity. Must just be major.minor.patch.", + "pattern": "^\\d+\\.\\d+\\.\\d+$" + }, + "apiVersion": { + "type": "integer", + "description": "The Activity System version this activity supports.", + "minimum": 1, + "maximum": 2 + }, + "logo": { + "type": "string", + "description": "The logo of the service this activity is for.", + "pattern": "^https?://.+\\.(png|jpe?g|gif|webp)$" + }, + "thumbnail": { + "type": "string", + "description": "A thumbnail of the service this activity is for.", + "pattern": "^https?://.+\\.(png|jpe?g|gif|webp)$" + }, + "color": { + "type": "string", + "description": "The theme color of the service this activity is for. Must be either a 6 digit or a 3 digit hex code.", + "pattern": "^#([A-Fa-f0-9]{3}){1,2}$" + }, + "tags": { + "type": [ + "array" + ], + "description": "The tags for the activity.", + "items": { + "type": "string", + "description": "A tag.", + "pattern": "^[^A-Z\\s!\"#$%&'()*+,./:;<=>?@\\[\\\\\\]^_`{|}~]+$" + }, + "minItems": 1 + }, + "category": { + "type": "string", + "description": "The category the activity falls under.", + "enum": [ + "anime", + "games", + "music", + "socials", + "videos", + "other" + ] + }, + "iframe": { + "type": "boolean", + "description": "Whether or not the activity should run in IFrames." + }, + "readLogs": { + "type": "boolean", + "description": "Whether or not the extension should be reading logs." + }, + "regExp": { + "type": "string", + "description": "A regular expression used to match URLs for the activity to inject into." + }, + "iFrameRegExp": { + "type": "string", + "description": "A regular expression used to match IFrames for the activity to inject into." + }, + "allowURLOverrides": { + "type": "boolean", + "description": "Whether or not the activity should allow URL overrides." + }, + "settings": { + "type": "array", + "description": "An array of settings the user can change in the activity.", + "items": { + "type": "object", + "description": "A setting.", + "properties": { + "id": { + "type": "string", + "description": "The ID of the setting." + }, + "title": { + "type": "string", + "description": "The title of the setting. Required only if `multiLanguage` is disabled." + }, + "description": { + "type": "string", + "description": "The description of the setting. Only applicable if `multiLanguage` is disabled." + }, + "icon": { + "type": "string", + "description": "The icon of the setting. Required only if `multiLanguage` is disabled.", + "pattern": "^fa([bsdrlt]|([-](brands|solid|duotone|regular|light|thin))) fa-[0-9a-z-]+$" + }, + "if": { + "type": "object", + "description": "Restrict showing this setting if another setting is the defined value.", + "propertyNames": { + "type": "string", + "description": "The ID of the setting." + }, + "patternProperties": { + "": { + "type": [ + "string", + "number", + "boolean" + ], + "description": "The value of the setting." + } + }, + "additionalProperties": false + }, + "placeholder": { + "type": "string", + "description": "The placeholder for settings that require input. Shown when the input is empty." + }, + "value": { + "type": [ + "string", + "number", + "boolean" + ], + "description": "The default value of the setting. Not compatible with `values`." + }, + "values": { + "type": "array", + "description": "The default values of the setting. Not compatible with `value`.", + "items": { + "type": [ + "string", + "number", + "boolean" + ], + "description": "The value of the setting." + } + }, + "multiLanguage": { + "type": "boolean", + "description": "When true, strings from the `general.json` file are available for use, plus the .json file. False is not allowed." + } + }, + "additionalProperties": false + } + }, + "mobile": { + "type": "boolean", + "description": "Whether or not the activity has support for mobile devices." + } + }, + "additionalProperties": false, + "required": [ + "author", + "service", + "description", + "url", + "version", + "apiVersion", + "logo", + "thumbnail", + "color", + "tags", + "category" + ] +}