add plugin iniformation

This commit is contained in:
Ryan McKinley
2025-12-18 10:42:50 +03:00
parent 68a65af091
commit 96e3fdbfd5
2 changed files with 17 additions and 1 deletions
+12
View File
@@ -19,6 +19,18 @@ func (b *DataSourceAPIBuilder) PostProcessOpenAPI(oas *spec3.OpenAPI) (*spec3.Op
// The plugin description
oas.Info.Description = b.pluginJSON.Info.Description
// Add plugin information
info := map[string]any{
"plugin": b.pluginJSON.ID,
}
if b.pluginJSON.Info.Version != "" {
info["version"] = b.pluginJSON.Info.Version
}
if b.pluginJSON.Info.Build.Time > 0 {
info["build"] = b.pluginJSON.Info.Build.Time
}
oas.Info.VendorExtensible.AddExtension("plugin", info)
// The root api URL
root := "/apis/" + b.datasourceResourceInfo.GroupVersion().String() + "/"
@@ -2,7 +2,11 @@
"openapi": "3.0.0",
"info": {
"description": "Generates test data in different forms",
"title": "testdata.datasource.grafana.app/v0alpha1"
"title": "testdata.datasource.grafana.app/v0alpha1",
"plugin": {
"plugin": "grafana-testdata-datasource",
"version": "12.4.0-pre"
}
},
"paths": {
"/apis/testdata.datasource.grafana.app/v0alpha1/": {