Commit 141c21c9 by Marcus Olsson Committed by GitHub

Docs: Clean up plugin.json schema (#24682)

parent 51509bb2
{ {
"$id": "https://grafana.com/plugin-metadata",
"$schema": "http://json-schema.org/draft-07/schema", "$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://example.com/example.json",
"type": "object", "type": "object",
"title": "plugin.json", "title": "plugin.json",
"description": "The plugin.json file is required for all plugins. When Grafana starts, it scans the plugin folders and mounts every folder that contains a plugin.json file unless the folder contains a subfolder named dist. In that case, Grafana mounts the dist folder instead.", "description": "The plugin.json file is required for all plugins. When Grafana starts, it scans the plugin folders and mounts every folder that contains a plugin.json file unless the folder contains a subfolder named dist. In that case, Grafana mounts the dist folder instead.",
...@@ -8,197 +8,153 @@ ...@@ -8,197 +8,153 @@
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"id": { "id": {
"$id": "#/properties/id",
"type": "string", "type": "string",
"description": "Unique name of the plugin. If the plugin is published on grafana.com, then the plugin id has to follow the naming conventions.", "description": "Unique name of the plugin. If the plugin is published on grafana.com, then the plugin id has to follow the naming conventions.",
"pattern": "^[0-9a-z\\-]+$" "pattern": "^[0-9a-z\\-]+$"
}, },
"type": { "type": {
"$id": "#/properties/type",
"type": "string", "type": "string",
"description": "Plugin type. Possible values are `app`, `datasource`, and `panel`.", "description": "Plugin type. Possible values are `app`, `datasource`, and `panel`.",
"enum": ["app", "datasource", "panel"] "enum": ["app", "datasource", "panel"]
}, },
"name": { "name": {
"$id": "#/properties/name",
"type": "string", "type": "string",
"description": "Human-readable name of the plugin that is shown to the user in the UI." "description": "Human-readable name of the plugin that is shown to the user in the UI."
}, },
"category": { "category": {
"$id": "#/properties/category",
"type": "string", "type": "string",
"description": "Plugin category used on the Add data source page. Possible values are: `tsdb`, `logging`, `cloud`, `tracing`, and `sql`.", "description": "Plugin category used on the Add data source page. Possible values are: `tsdb`, `logging`, `cloud`, `tracing`, and `sql`.",
"enum": ["tsdb", "logging", "cloud", "tracing", "sql"] "enum": ["tsdb", "logging", "cloud", "tracing", "sql"]
}, },
"annotations": { "annotations": {
"$id": "#/properties/annotations",
"type": "boolean", "type": "boolean",
"description": "For data source plugins. If the plugin supports annotation queries.", "description": "For data source plugins. If the plugin supports annotation queries."
"default": false
}, },
"alerting": { "alerting": {
"$id": "#/properties/alerting",
"type": "boolean", "type": "boolean",
"description": "For data source plugins. If the plugin supports alerting.", "description": "For data source plugins. If the plugin supports alerting."
"default": false
}, },
"backend": { "backend": {
"$id": "#/properties/backend",
"type": "boolean", "type": "boolean",
"description": "If the plugin has a backend component.", "description": "If the plugin has a backend component."
"default": false
}, },
"executable": { "executable": {
"$id": "#/properties/executable",
"type": "string", "type": "string",
"description": "The first part of the file name of the backend component executable. There can be multiple executables built for different operating system and architecture. Grafana will check for executables named `<executable>_<$GOOS>_<lower case $GOARCH><.exe for Windows>`, e.g. `plugin_linux_amd64`. Combination of $GOOS and $GOARCH can be found here: https://golang.org/doc/install/source#environment." "description": "The first part of the file name of the backend component executable. There can be multiple executables built for different operating system and architecture. Grafana will check for executables named `<executable>_<$GOOS>_<lower case $GOARCH><.exe for Windows>`, e.g. `plugin_linux_amd64`. Combination of $GOOS and $GOARCH can be found here: https://golang.org/doc/install/source#environment."
}, },
"includes": { "includes": {
"$id": "#/properties/includes",
"type": "array", "type": "array",
"items": { "items": {
"$id": "#/properties/includes/items",
"type": "object", "type": "object",
"additionalItems": false, "additionalItems": false,
"properties": { "properties": {
"type": { "type": {
"$id": "#/properties/includes/items/properties/type",
"type": "string" "type": "string"
}, },
"name": { "name": {
"$id": "#/properties/includes/items/properties/name",
"type": "string" "type": "string"
}, },
"component": { "component": {
"$id": "#/properties/includes/items/properties/component",
"type": "string" "type": "string"
}, },
"role": { "role": {
"$id": "#/properties/includes/items/properties/role",
"type": "string" "type": "string"
}, },
"addToNav": { "addToNav": {
"$id": "#/properties/includes/items/properties/addToNav",
"type": "boolean" "type": "boolean"
}, },
"defaultNav": { "defaultNav": {
"$id": "#/properties/includes/items/properties/defaultNav",
"type": "boolean" "type": "boolean"
} }
} }
} }
}, },
"logs": { "logs": {
"$id": "#/properties/logs",
"type": "boolean", "type": "boolean",
"description": "For data source plugins. If the plugin supports logs.", "description": "For data source plugins. If the plugin supports logs."
"default": false
}, },
"partials": { "partials": {
"$id": "#/properties/partials",
"type": "object", "type": "object",
"additionalItems": false, "additionalItems": false,
"properties": { "properties": {
"config": { "config": {
"$id": "#/properties/partials/properties/config",
"type": "string" "type": "string"
} }
} }
}, },
"metrics": { "metrics": {
"$id": "#/properties/metrics",
"type": "boolean", "type": "boolean",
"description": "For data source plugins. If the plugin supports metric queries. Used in the Explore feature.", "description": "For data source plugins. If the plugin supports metric queries. Used in the Explore feature."
"default": false
}, },
"mixed": { "mixed": {
"$id": "#/properties/mixed",
"type": "boolean", "type": "boolean",
"description": "Not to be used by external plugins. Special property for the built-in mixed plugin." "description": "Not to be used by external plugins. Special property for the built-in mixed plugin."
}, },
"module": { "module": {
"$id": "#/properties/module",
"type": "string" "type": "string"
}, },
"sort": { "sort": {
"$id": "#/properties/sort",
"type": "number", "type": "number",
"description": "Internal property for sorting. Cannot be used as will be overwritten by Grafana." "description": "Internal property for sorting. Cannot be used as will be overwritten by Grafana."
}, },
"staticRoot": { "staticRoot": {
"$id": "#/properties/staticRoot",
"type": "string" "type": "string"
}, },
"streaming": { "streaming": {
"$id": "#/properties/streaming",
"type": "boolean", "type": "boolean",
"description": "For data source plugins. If the plugin supports streaming.", "description": "For data source plugins. If the plugin supports streaming."
"default": false
}, },
"tables": { "tables": {
"$id": "#/properties/tables", "type": "boolean"
"type": "boolean",
"default": false
}, },
"tracing": { "tracing": {
"$id": "#/properties/tracing",
"type": "boolean", "type": "boolean",
"description": "For data source plugins. If the plugin supports tracing.", "description": "For data source plugins. If the plugin supports tracing."
"default": false
}, },
"hiddenQueries": { "hiddenQueries": {
"$id": "#/properties/hiddenQueries",
"type": "boolean" "type": "boolean"
}, },
"dependencies": { "dependencies": {
"$id": "#/properties/dependencies",
"type": "object", "type": "object",
"description": "Plugin dependencies.", "description": "Plugin dependencies.",
"required": ["grafanaVersion"], "required": ["grafanaVersion"],
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"grafanaVersion": { "grafanaVersion": {
"$id": "#/properties/dependencies/properties/grafanaVersion",
"type": "string", "type": "string",
"description": "Required Grafana version for this plugin, e.g. `6.x.x 7.x.x` to denote plugin requires Grafana v6.x.x or v7.x.x.", "description": "Required Grafana version for this plugin, e.g. `6.x.x 7.x.x` to denote plugin requires Grafana v6.x.x or v7.x.x.",
"pattern": "^([0-9x]+\\.[0-9x]+\\.*[0-9x]*\\s*)+$" "pattern": "^([0-9x]+\\.[0-9x]+\\.*[0-9x]*\\s*)+$"
}, },
"plugins": { "plugins": {
"$id": "#/properties/dependencies/properties/plugins",
"type": "array", "type": "array",
"description": "An array of required plugins on which this plugin depends.", "description": "An array of required plugins on which this plugin depends.",
"items": { "items": {
"$id": "#/properties/dependencies/properties/plugins/items" "type": "string"
} }
} }
} }
}, },
"info": { "info": {
"$id": "#/properties/info",
"type": "object", "type": "object",
"description": "Metadata for the plugin. Some fields are used on the plugins page in Grafana and others on grafana.com if the plugin is published.", "description": "Metadata for the plugin. Some fields are used on the plugins page in Grafana and others on grafana.com if the plugin is published.",
"required": ["logos", "version", "updated"], "required": ["logos", "version", "updated"],
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"author": { "author": {
"$id": "#/properties/info/properties/author",
"type": "object", "type": "object",
"description": "Information about the plugin author.", "description": "Information about the plugin author.",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"name": { "name": {
"$id": "#/properties/info/properties/author/properties/name",
"type": "string", "type": "string",
"description": "Author's name." "description": "Author's name."
}, },
"email": { "email": {
"$id": "#/properties/info/properties/author/properties/email",
"type": "string", "type": "string",
"description": "Author's name.", "description": "Author's name.",
"format": "email" "format": "email"
}, },
"url": { "url": {
"$id": "#/properties/info/properties/author/properties/url",
"type": "string", "type": "string",
"description": "Link to author's website.", "description": "Link to author's website.",
"format": "uri" "format": "uri"
...@@ -206,24 +162,20 @@ ...@@ -206,24 +162,20 @@
} }
}, },
"description": { "description": {
"$id": "#/properties/info/properties/description",
"type": "string", "type": "string",
"description": "Description of plugin. Used on the plugins page in Grafana and for search on grafana.com." "description": "Description of plugin. Used on the plugins page in Grafana and for search on grafana.com."
}, },
"keywords": { "keywords": {
"$id": "#/properties/info/properties/keywords",
"type": "array", "type": "array",
"description": "Array of plugin keywords. Used for search on grafana.com.", "description": "Array of plugin keywords. Used for search on grafana.com.",
"items": { "items": {
"$id": "#/properties/info/properties/keywords/items" "type": "string"
} }
}, },
"links": { "links": {
"$id": "#/properties/info/properties/links",
"type": "array", "type": "array",
"description": "An array of link objects to be displayed on this plugin's project page in the form `{name: 'foo', url: 'http://example.com'}`", "description": "An array of link objects to be displayed on this plugin's project page in the form `{name: 'foo', url: 'http://example.com'}`",
"items": { "items": {
"$id": "#/properties/info/properties/links/items",
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
...@@ -238,54 +190,43 @@ ...@@ -238,54 +190,43 @@
} }
}, },
"logos": { "logos": {
"$id": "#/properties/info/properties/logos",
"type": "object", "type": "object",
"description": "SVG images that are used as plugin icons.", "description": "SVG images that are used as plugin icons.",
"required": ["small", "large"], "required": ["small", "large"],
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"small": { "small": {
"$id": "#/properties/info/properties/logos/properties/small",
"type": "string", "type": "string",
"description": "Link to the \"small\" version of the plugin logo, which must be an SVG image. \"Large\" and \"small\" logos can be the same image.", "description": "Link to the \"small\" version of the plugin logo, which must be an SVG image. \"Large\" and \"small\" logos can be the same image."
"examples": ["img/logo.svg"]
}, },
"large": { "large": {
"$id": "#/properties/info/properties/logos/properties/large",
"type": "string", "type": "string",
"description": "Link to the \"large\" version of the plugin logo, which must be an SVG image. \"Large\" and \"small\" logos can be the same image.", "description": "Link to the \"large\" version of the plugin logo, which must be an SVG image. \"Large\" and \"small\" logos can be the same image."
"examples": ["img/logo.svg"]
} }
} }
}, },
"screenshots": { "screenshots": {
"$id": "#/properties/info/properties/screenshots",
"type": "array", "type": "array",
"description": "An array of screenshot objects in the form `{name: 'bar', path: 'img/screenshot.png'}`", "description": "An array of screenshot objects in the form `{name: 'bar', path: 'img/screenshot.png'}`",
"items": { "items": {
"$id": "#/properties/info/properties/screenshots/items",
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"name": { "name": {
"$id": "#/properties/info/properties/screenshots/items/properties/name",
"type": "string" "type": "string"
}, },
"path": { "path": {
"$id": "#/properties/info/properties/screenshots/items/properties/path",
"type": "string" "type": "string"
} }
} }
} }
}, },
"updated": { "updated": {
"$id": "#/properties/info/properties/updated",
"type": "string", "type": "string",
"description": "Date when this plugin was built.", "description": "Date when this plugin was built.",
"pattern": "^(\\d{4}-\\d{2}-\\d{2}|\\%TODAY\\%)$" "pattern": "^(\\d{4}-\\d{2}-\\d{2}|\\%TODAY\\%)$"
}, },
"version": { "version": {
"$id": "#/properties/info/properties/version",
"type": "string", "type": "string",
"description": "Project version of this commit, e.g. `6.7.x`.", "description": "Project version of this commit, e.g. `6.7.x`.",
"pattern": "^([0-9x]+\\.[0-9x]+\\.*[0-9x]*$|\\%VERSION\\%)" "pattern": "^([0-9x]+\\.[0-9x]+\\.*[0-9x]*$|\\%VERSION\\%)"
...@@ -293,102 +234,83 @@ ...@@ -293,102 +234,83 @@
} }
}, },
"queryOptions": { "queryOptions": {
"$id": "#/properties/queryOptions",
"type": "object", "type": "object",
"description": "For data source plugins. There is a query options section in the plugin's query editor and these options can be turned on if needed.", "description": "For data source plugins. There is a query options section in the plugin's query editor and these options can be turned on if needed.",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"maxDataPoints": { "maxDataPoints": {
"$id": "#/properties/queryOptions/properties/maxDataPoints",
"type": "boolean", "type": "boolean",
"description": "For data source plugins. If the `max data points` option should be shown in the query options section in the query editor." "description": "For data source plugins. If the `max data points` option should be shown in the query options section in the query editor."
}, },
"minInterval": { "minInterval": {
"$id": "#/properties/queryOptions/properties/minInterval",
"type": "boolean", "type": "boolean",
"description": "For data source plugins. If the `min interval` option should be shown in the query options section in the query editor." "description": "For data source plugins. If the `min interval` option should be shown in the query options section in the query editor."
}, },
"cacheTimeout": { "cacheTimeout": {
"$id": "#/properties/queryOptions/properties/cacheTimeout",
"type": "boolean", "type": "boolean",
"description": "For data source plugins. If the `cache timeout` option should be shown in the query options section in the query editor." "description": "For data source plugins. If the `cache timeout` option should be shown in the query options section in the query editor."
} }
} }
}, },
"routes": { "routes": {
"$id": "#/properties/routes",
"type": "array", "type": "array",
"description": "For data source plugins. Proxy routes used for plugin authentication and adding headers to HTTP requests made by the plugin. For more information, refer to [Authentication for data source plugins](https://grafana.com/docs/grafana/latest/developers/plugins/authentication/).", "description": "For data source plugins. Proxy routes used for plugin authentication and adding headers to HTTP requests made by the plugin. For more information, refer to [Authentication for data source plugins](https://grafana.com/docs/grafana/latest/developers/plugins/authentication/).",
"items": { "items": {
"$id": "#/properties/routes/items",
"type": "object", "type": "object",
"description": "For data source plugins. Proxy routes used for plugin authentication and adding headers to HTTP requests made by the plugin. For more information, refer to [Authentication for data source plugins](https://grafana.com/docs/grafana/latest/developers/plugins/authentication/).", "description": "For data source plugins. Proxy routes used for plugin authentication and adding headers to HTTP requests made by the plugin. For more information, refer to [Authentication for data source plugins](https://grafana.com/docs/grafana/latest/developers/plugins/authentication/).",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"path": { "path": {
"$id": "#/properties/routes/items/properties/path",
"type": "string", "type": "string",
"description": "For data source plugins. The route path that is replaced by the route URL field when proxying the call." "description": "For data source plugins. The route path that is replaced by the route URL field when proxying the call."
}, },
"method": { "method": {
"$id": "#/properties/routes/items/properties/method",
"type": "string", "type": "string",
"description": "For data source plugins. Route method matches the HTTP verb like GET or POST." "description": "For data source plugins. Route method matches the HTTP verb like GET or POST."
}, },
"url": { "url": {
"$id": "#/properties/routes/items/properties/url",
"type": "string", "type": "string",
"description": "For data source plugins. Route URL is where the request is proxied to.", "description": "For data source plugins. Route URL is where the request is proxied to.",
"format": "uri" "format": "uri"
}, },
"reqSignedIn": { "reqSignedIn": {
"$id": "#/properties/routes/items/properties/reqSignedIn",
"type": "boolean" "type": "boolean"
}, },
"reqRole": { "reqRole": {
"$id": "#/properties/routes/items/properties/reqRole",
"type": "string" "type": "string"
}, },
"headers": { "headers": {
"$id": "#/properties/routes/items/properties/headers",
"type": "array", "type": "array",
"description": "For data source plugins. Route headers adds HTTP headers to the proxied request." "description": "For data source plugins. Route headers adds HTTP headers to the proxied request."
}, },
"tokenAuth": { "tokenAuth": {
"$id": "#/properties/routes/items/properties/tokenAuth",
"type": "object", "type": "object",
"description": "For data source plugins. Token authentication section used with an OAuth API.", "description": "For data source plugins. Token authentication section used with an OAuth API.",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"url": { "url": {
"$id": "#/properties/routes/items/properties/tokenAuth/properties/url",
"type": "string", "type": "string",
"description": "For data source plugins. URL to fetch the authentication token.", "description": "For data source plugins. URL to fetch the authentication token.",
"format": "uri" "format": "uri"
}, },
"params": { "params": {
"$id": "#/properties/routes/items/properties/tokenAuth/properties/params",
"type": "object", "type": "object",
"description": "For data source plugins. Parameters for the token authentication request.", "description": "For data source plugins. Parameters for the token authentication request.",
"additionalProperties": false, "additionalProperties": false,
"properties": { "properties": {
"grant_type": { "grant_type": {
"$id": "#/properties/routes/items/properties/tokenAuth/properties/params/properties/grant_type",
"type": "string", "type": "string",
"description": "For data source plugins. OAuth grant type." "description": "For data source plugins. OAuth grant type."
}, },
"client_id": { "client_id": {
"$id": "#/properties/routes/items/properties/tokenAuth/properties/params/properties/client_id",
"type": "string", "type": "string",
"description": "For data source plugins. OAuth client id." "description": "For data source plugins. OAuth client id."
}, },
"client_secret": { "client_secret": {
"$id": "#/properties/routes/items/properties/tokenAuth/properties/params/properties/client_secret",
"type": "string", "type": "string",
"description": "For data source plugins. OAuth client secret. Usually populated by decrypting the secret from the SecureJson blob." "description": "For data source plugins. OAuth client secret. Usually populated by decrypting the secret from the SecureJson blob."
}, },
"resource": { "resource": {
"$id": "#/properties/routes/items/properties/tokenAuth/properties/params/properties/client_secret",
"type": "string", "type": "string",
"description": "For data source plugins. OAuth resource." "description": "For data source plugins. OAuth resource."
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment