Plugin.json schema: Update the meta-info for extensions (#92732)

* feat(plugin.json): update the extensions definition schema

* feat(plugin.json): add `exposedComponents` definition to the dependencies

* feat(plugin.schema.json): add descriptions for the new schema fields

* review: wrap extensions related dependencies

* review: add a pattern for the extension point id

* review: add a min-length to added link & component titles

* add a pattern to the exposed component id
This commit is contained in:
Levente Balogh 2024-09-17 14:06:23 +02:00 committed by GitHub
parent 10314585ec
commit f0ce33e569
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -198,6 +198,19 @@
}
}
}
},
"extensions": {
"type": "object",
"description": "Plugin extensions that this plugin depends on.",
"properties": {
"exposedComponents": {
"type": "array",
"description": "An array of exposed component ids that this plugin depends on.",
"items": {
"type": "string"
}
}
}
}
}
},
@ -566,26 +579,107 @@
}
},
"extensions": {
"type": "array",
"description": "List of link and component extensions which the plugin registers to given extension points.",
"items": {
"type": "object",
"properties": {
"extensionPointId": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["link", "component"]
"type": "object",
"description": "Plugin extensions are a way to extend either the UI of core Grafana or other plugins.",
"properties": {
"addedComponents": {
"type": "array",
"description": "Any component extensions that your plugin registers to extension points.",
"items": {
"type": "object",
"properties": {
"targets": {
"type": "array",
"description": "The list of the targeted extension point ids that the component is added to.",
"items": {
"type": "string"
}
},
"title": {
"type": "string",
"description": "An informative title for your component extension.",
"minLength": 10
},
"description": {
"type": "string",
"description": "Additional information about your component extension."
}
},
"required": ["targets", "title"]
}
},
"required": ["extensionPointId", "title", "type"]
"addedLinks": {
"type": "array",
"description": "Any link extensions that your plugin registers to extension points.",
"items": {
"type": "object",
"properties": {
"targets": {
"type": "array",
"description": "The list of the targeted extension point ids that the link is added to.",
"items": {
"type": "string"
}
},
"title": {
"type": "string",
"description": "An informative title for your link extension.",
"minLength": 10
},
"description": {
"type": "string",
"description": "Additional information about your link extension."
}
},
"required": ["targets", "title"]
}
},
"exposedComponents": {
"type": "array",
"description": "Any React component that your plugin exposes so it can be reused by other app plugins.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "A unique identifier for your exposed component. This is used to reference the component in other plugins. It must be in the following format: '{PLUGIN_ID}/name-of-component/v1'.",
"pattern": "^[0-9a-z]+-([0-9a-z]+-)?(app|panel|datasource|secretsmanager)\\/[a-zA-Z0-9_-]+\\/v[0-9_.-]+$"
},
"title": {
"type": "string",
"description": "An informative title for your exposed component."
},
"description": {
"type": "string",
"description": "Additional information about your exposed component."
}
},
"required": ["id"]
}
},
"extensionPoints": {
"type": "array",
"description": "Any extension points that your plugin provides.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "A unique identifier for your extension point. This is used to reference the extension point in other plugins. It must be in the following format: '{PLUGIN_ID}/name-of-my-extension-point/v1'.",
"pattern": "^[0-9a-z]+-([0-9a-z]+-)?(app|panel|datasource|secretsmanager)\\/[a-zA-Z0-9_-]+\\/v[0-9_.-]+$"
},
"title": {
"type": "string",
"description": "An informative title for your extension point."
},
"description": {
"type": "string",
"description": "Additional information about your extension point."
}
},
"required": ["id"]
}
}
}
}
}