{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/samva-dev/json-schema/samva-dev-publish-extension-version-payload-schema.json",
  "title": "PublishExtensionVersionPayload",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/samva-dev-extensions-api-openapi.yml#/components/schemas/PublishExtensionVersionPayload",
  "type": "object",
  "properties": {
    "manifest": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]{1,62}[a-z0-9]$"
        },
        "displayName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80,
          "x-samva-string-checks": [
            {
              "id": "effect/schema/isMaxLength",
              "payload": {
                "maxLength": 80
              }
            }
          ]
        },
        "description": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500,
              "x-samva-string-checks": [
                {
                  "id": "effect/schema/isMaxLength",
                  "payload": {
                    "maxLength": 500
                  }
                }
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "version": {
          "type": "string",
          "pattern": "^\\d{1,6}\\.\\d{1,6}\\.\\d{1,6}(?:-[0-9A-Za-z.-]{1,64})?$"
        },
        "runtime": {
          "type": "string",
          "enum": [
            "hosted",
            "webhook"
          ]
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "mailbox.message.received",
              "mailbox.message.sent",
              "mailbox.action.pending_approval",
              "mailbox.action.resolved",
              "mailbox.message.quarantined",
              "mailbox.message.released",
              "mailbox.message.discarded"
            ]
          },
          "minItems": 1
        },
        "permissions": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "read",
              "update",
              "send",
              "quarantine.read"
            ]
          }
        }
      },
      "required": [
        "name",
        "displayName",
        "version",
        "runtime",
        "events",
        "permissions"
      ],
      "additionalProperties": false
    },
    "bundle": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "manifest"
  ],
  "additionalProperties": false
}