{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://sourcegraph.com/v1/extension.schema.json#",
  "title": "Sourcegraph extension manifest",
  "description": "The Sourcegraph extension manifest describes the extension and the features it provides.",
  "type": "object",
  "additionalProperties": false,
  "required": ["url", "activationEvents"],
  "properties": {
    "title": {
      "description": "The title of the extension. If not specified, the extension ID is used.",
      "type": "string"
    },
    "description": {
      "description":
        "The extension's description, which summarizes the extension's purpose and features. It should not exceed a few sentences.",
      "type": "string",
      "maxLength": 280
    },
    "icon": {
      "description": "The extension icon in data URI format (must begin with data:image/png).",
      "type": "string",
      "format": "^data:image/png"
    },
    "readme": {
      "description":
        "The extension's README, which should describe (in detail) the extension's purpose, features, and usage instructions. Markdown formatting is supported.",
      "type": "string",
      "format": "markdown"
    },
    "url": {
      "description": "A URL to a file containing the bundled JavaScript source code of this extension.",
      "type": "string",
      "format": "uri"
    },
    "repository": {
      "$ref": "#/definitions/ExtensionRepository"
    },
    "activationEvents": {
      "description":
        "A list of events that cause this extension to be activated. '*' means that it will always be activated.",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^(\\*|onLanguage:\\w+)$",
        "examples": ["onLanguage:javascript", "onLanguage:python", "*"]
      }
    },
    "args": {
      "description":
        "Arguments provided to the extension upon initialization (in the `initialize` message's `initializationOptions` field).",
      "type": "object",
      "additionalProperties": true,
      "!go": {
        "pointer": true
      }
    },
    "contributes": {
      "$ref": "#/definitions/Contributions"
    }
  },
  "definitions": {
    "Contributions": {
      "description":
        "Features contributed by this extension. Extensions may also register certain types of contributions dynamically.",
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "configuration": {
          "description":
            "The JSON Schema for the configuration settings used by this extension. This schema is merged with the Sourcegraph settings schema. The final schema for settings is the union of Sourcegraph settings and all added extensions' settings.",
          "$ref": "http://json-schema.org/draft-07/schema#"
        },
        "actions": {
          "description": "The actions that this extension supports.",
          "type": "array",
          "items": {
            "type": "object",
            "title": "action",
            "properties": {
              "id": {
                "description": "The unique ID for this action.",
                "type": "string"
              },
              "command": {
                "description": "The command to execute when this action is taken.",
                "type": "string"
              },
              "commandArguments": {
                "description": "The arguments to the command.",
                "type": "array",
                "items": {}
              },
              "title": {
                "description": "The templated text that is shown in the UI.",
                "type": "string"
              },
              "category": {
                "description":
                  "The templated prefix for the title (e.g. a category of `Codecov` shows up as `Codecov: ...` in the command palette).",
                "type": "string"
              },
              "iconURL": {
                "description": "The templated icon that is shown in the UI (usually a data URI).",
                "type": "string"
              },
              "actionItem": {
                "description": "The action item.",
                "type": "object",
                "properties": {
                  "label": {
                    "description": "The templated text that is shown on the action item the UI.",
                    "type": "string"
                  },
                  "description": {
                    "description": "The templated tooltip text for an action item that is shown in the UI.",
                    "type": "string"
                  },
                  "iconURL": {
                    "description": "The templated icon that is shown in the UI (usually a data URI).",
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "menus": {
          "description": "Describes where to place actions in menus.",
          "type": "object",
          "properties": {
            "editor/title": {
              "description": "The file header.",
              "type": "array",
              "items": { "$ref": "#/definitions/MenuItem" }
            },
            "commandPalette": {
              "description": "The command palette (usually in the upper right).",
              "type": "array",
              "items": { "$ref": "#/definitions/MenuItem" }
            },
            "help": {
              "description": "The help menu.",
              "type": "array",
              "items": { "$ref": "#/definitions/MenuItem" }
            }
          }
        }
      }
    },
    "MenuItem": {
      "type": "object",
      "properties": {
        "action": {
          "description": "The ID of the action to take when this menu item is clicked.",
          "type": "string"
        },
        "alt": {
          "description": "The tooltip text to show when hovering over this menu item.",
          "type": "string"
        },
        "when": {
          "description": "An expression that determines whether or not to show this menu item.",
          "type": "string"
        }
      }
    },
    "ExtensionRepository": {
      "description": "The location of the version control repository for this extension.",
      "type": "object",
      "additionalProperties": false,
      "required": ["url"],
      "properties": {
        "type": {
          "description": "The version control system (e.g. git).",
          "type": "string"
        },
        "url": {
          "description": "A URL to the source code for this extension.",
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
