{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sofinder.sohophp.app/schema/plugin-descriptor.schema.json",
  "title": "SoFinder plugin descriptor",
  "type": "object",
  "additionalProperties": false,
  "required": ["descriptorVersion", "name", "version", "capabilities"],
  "properties": {
    "descriptorVersion": { "const": "1.0" },
    "name": { "type": "string", "pattern": "^[a-z][a-z0-9._-]{1,63}$" },
    "version": { "type": "string", "pattern": "^[0-9A-Za-z][0-9A-Za-z.+_-]*$", "maxLength": 64 },
    "capabilities": { "type": "array", "uniqueItems": true, "items": { "type": "string", "pattern": "^[a-z][a-z0-9._-]{0,63}$" } },
    "resourceTypes": { "type": "array", "uniqueItems": true, "items": { "enum": ["any", "file", "image", "directory"] } },
    "requiredOperations": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
    "configurationKeys": { "type": "array", "uniqueItems": true, "items": { "type": "string" } },
    "uiActions": { "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/action" } },
    "previewers": { "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/previewer" } },
    "extensions": { "type": "object" }
  },
  "$defs": {
    "label": { "type": "object", "required": ["en"], "additionalProperties": false, "properties": { "en": { "type": "string" }, "zh-cn": { "type": "string" }, "zh-tw": { "type": "string" } } },
    "action": { "type": "object", "additionalProperties": false, "required": ["id", "label", "slot", "url"], "properties": { "id": { "type": "string" }, "label": { "$ref": "#/$defs/label" }, "slot": { "enum": ["utility", "toolbar", "context", "details"] }, "url": { "type": "string", "pattern": "^/(?!/)" }, "selection": { "enum": ["none", "any", "file", "image"] }, "requires": { "type": "string" } } },
    "previewer": { "type": "object", "additionalProperties": false, "required": ["id", "url"], "properties": { "id": { "type": "string" }, "url": { "type": "string", "pattern": "^/(?!/)" }, "mimeTypes": { "type": "array", "items": { "type": "string" } }, "extensions": { "type": "array", "items": { "type": "string" } } } }
  }
}
