Skip to content

Instantly share code, notes, and snippets.

@sdboyer
Created July 12, 2022 20:08
Show Gist options
  • Save sdboyer/2bda089fb5625be9631530971c4ae057 to your computer and use it in GitHub Desktop.
Save sdboyer/2bda089fb5625be9631530971c4ae057 to your computer and use it in GitHub Desktop.
shorty mcshorterface
package pluginmeta
import "github.com/grafana/thema"
thema.#Lineage
name: "pluginmeta"
seqs: [
{
schemas: [
{
id: =~"^[0-9a-z]+\\-([0-9a-z]+\\-)?(app|panel|datasource)$"
type: "app" | "datasource" | "panel"
name: string
category?: "tsdb" | "logging" | "cloud" | "tracing" | "sql" | "enterprise" | "other"
annotations?: bool
alerting?: bool
backend?: bool
executable?: string
preload?: bool
state?: "alpha" | "beta"
includes?: [...{
uid?: string
type?: "dashboard" | "page" | "panel" | "datasource"
name?: string
component?: string
role?: "Admin" | "Editor" | "Viewer"
path?: string
addToNav?: bool
defaultNav?: bool
icon?: string
...
}]
logs?: bool
skipDataQuery?: bool
metrics?: bool
streaming?: bool
tables?: bool
tracing?: bool
hiddenQueries?: bool
autoEnabled?: bool
dependencies: {
grafanaVersion?: =~"^([0-9]+)(\\.[0-9x]+)?(\\.[0-9x])?$"
grafanaDependency: =~"^(<=|>=|<|>|=|~|\\^)?([0-9]+)(\\.[0-9x\\*]+)(\\.[0-9x\\*])?(\\s(<=|>=|<|=>)?([0-9]+)(\\.[0-9x]+)(\\.[0-9x]))?$"
plugins?: [...{
id: =~"^[0-9a-z]+\\-([0-9a-z]+\\-)?(app|panel|datasource)$"
type: "app" | "datasource" | "panel"
name: string
version: string
...
}]
}
info: {
author?: {
name?: string
email?: string
url?: string
}
build?: {
time?: number
repo?: string
branch?: string
hash?: string
numberr?: number
pr?: number
}
description?: string
keywords: [...string]
links?: [...{
name?: string
url?: string
}]
logos: {
small: string
large: string
}
screenshots?: [...{
name?: string
path?: string
}]
updated: =~"^(\\d{4}-\\d{2}-\\d{2}|\\%TODAY\\%)$"
version: =~"^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*$|\\%VERSION\\%)"
}
queryOptions?: {
maxDataPoints?: bool
minInterval?: bool
cacheTimeout?: bool
}
routes?: [...{
path?: string
method?: string
url?: string
reqSignedIn?: bool
reqRole?: string
headers?: [...]
body?: {
...
}
tokenAuth?: {
url?: string
scopes?: [...string]
params?: {
grant_type?: string
client_id?: string
client_secret?: string
resource?: string
}
}
jwtTokenAuth?: {
url?: string
scopes?: [...string]
params?: {
token_uri?: string
client_email?: string
private_key?: string
}
}
}]
enterpriseFeatures?: {
healthDiagnosticsErrors?: bool | *false
...
}
},
]
},
]
{
"$id": "https://grafana.com/plugin-metadata",
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"title": "plugin.json",
"required": ["type", "name", "id", "info", "dependencies"],
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string"
},
"id": {
"type": "string",
"pattern": "^[0-9a-z]+\\-([0-9a-z]+\\-)?(app|panel|datasource)$"
},
"type": {
"type": "string",
"enum": ["app", "datasource", "panel"]
},
"name": {
"type": "string"
},
"category": {
"type": "string",
"enum": ["tsdb", "logging", "cloud", "tracing", "sql", "enterprise", "other"]
},
"annotations": {
"type": "boolean"
},
"alerting": {
"type": "boolean"
},
"backend": {
"type": "boolean"
},
"executable": {
"type": "string"
},
"preload": {
"type": "boolean"
},
"state": {
"type": "string",
"enum": ["alpha", "beta"]
},
"includes": {
"type": "array",
"items": {
"type": "object",
"additionalItems": false,
"properties": {
"uid": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["dashboard", "page", "panel", "datasource"]
},
"name": {
"type": "string"
},
"component": {
"type": "string"
},
"role": {
"type": "string",
"enum": ["Admin", "Editor", "Viewer"]
},
"path": {
"type": "string"
},
"addToNav": {
"type": "boolean"
},
"defaultNav": {
"type": "boolean"
},
"icon": {
"type": "string"
}
}
}
},
"logs": {
"type": "boolean"
},
"skipDataQuery": {
"type": "boolean"
},
"metrics": {
"type": "boolean"
},
"streaming": {
"type": "boolean"
},
"tables": {
"type": "boolean"
},
"tracing": {
"type": "boolean"
},
"hiddenQueries": {
"type": "boolean"
},
"autoEnabled": {
"type": "boolean"
},
"dependencies": {
"type": "object",
"required": ["grafanaDependency"],
"additionalProperties": false,
"properties": {
"grafanaVersion": {
"type": "string",
"pattern": "^([0-9]+)(\\.[0-9x]+)?(\\.[0-9x])?$"
},
"grafanaDependency": {
"type": "string",
"pattern": "^(<=|>=|<|>|=|~|\\^)?([0-9]+)(\\.[0-9x\\*]+)(\\.[0-9x\\*])?(\\s(<=|>=|<|=>)?([0-9]+)(\\.[0-9x]+)(\\.[0-9x]))?$"
},
"plugins": {
"type": "array",
"additionalItems": false,
"items": {
"type": "object",
"required": ["id", "name", "type", "version"],
"properties": {
"id": {
"type": "string",
"pattern": "^[0-9a-z]+\\-([0-9a-z]+\\-)?(app|panel|datasource)$"
},
"type": {
"type": "string",
"enum": ["app", "datasource", "panel"]
},
"name": {
"type": "string"
},
"version": {
"type": "string"
}
}
}
}
}
},
"info": {
"type": "object",
"required": ["logos", "version", "updated", "keywords"],
"additionalProperties": false,
"properties": {
"author": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"url": {
"type": "string",
"format": "uri"
}
}
},
"build": {
"type": "object",
"additionalProperties": false,
"properties": {
"time": {
"type": "number"
},
"repo": {
"type": "string"
},
"branch": {
"type": "string"
},
"hash": {
"type": "string"
},
"number": {
"type": "number"
},
"pr": {
"type": "number"
}
}
},
"type": "string"
},
"keywords": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
}
},
"links": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
}
}
}
},
"logos": {
"type": "object",
"required": ["small", "large"],
"additionalProperties": false,
"properties": {
"small": {
"type": "string"
},
"large": {
"type": "string"
}
}
},
"screenshots": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
"path": {
"type": "string"
}
}
}
},
"updated": {
"type": "string",
"pattern": "^(\\d{4}-\\d{2}-\\d{2}|\\%TODAY\\%)$"
},
"version": {
"type": "string",
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*$|\\%VERSION\\%)"
}
}
},
"queryOptions": {
"type": "object",
"additionalProperties": false,
"properties": {
"maxDataPoints": {
"type": "boolean"
},
"minInterval": {
"type": "boolean"
},
"cacheTimeout": {
"type": "boolean"
}
}
},
"routes": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string"
},
"method": {
"type": "string"
},
"url": {
"type": "string"
},
"reqSignedIn": {
"type": "boolean"
},
"reqRole": {
"type": "string"
},
"headers": {
"type": "array"
},
"body": {
"type": "object"
},
"tokenAuth": {
"type": "object",
"additionalProperties": false,
"properties": {
"url": {
"type": "string"
},
"scopes": {
"type": "array",
"items": {
"type": "string"
}
},
"params": {
"type": "object",
"additionalProperties": false,
"properties": {
"grant_type": {
"type": "string"
},
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
},
"resource": {
"type": "string"
}
}
}
}
},
"jwtTokenAuth": {
"type": "object",
"additionalProperties": false,
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"scopes": {
"type": "array",
"items": {
"type": "string"
}
},
"params": {
"type": "object",
"additionalProperties": false,
"properties": {
"token_uri": {
"type": "string"
},
"client_email": {
"type": "string"
},
"private_key": {
"type": "string"
}
}
}
}
}
}
}
},
"enterpriseFeatures": {
"type": "object",
"additionalProperties": true,
"properties": {
"healthDiagnosticsErrors": {
"type": "boolean",
"default": false
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment