add plugin iniformation
This commit is contained in:
@@ -19,6 +19,18 @@ func (b *DataSourceAPIBuilder) PostProcessOpenAPI(oas *spec3.OpenAPI) (*spec3.Op
|
|||||||
// The plugin description
|
// The plugin description
|
||||||
oas.Info.Description = b.pluginJSON.Info.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
|
// The root api URL
|
||||||
root := "/apis/" + b.datasourceResourceInfo.GroupVersion().String() + "/"
|
root := "/apis/" + b.datasourceResourceInfo.GroupVersion().String() + "/"
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -2,7 +2,11 @@
|
|||||||
"openapi": "3.0.0",
|
"openapi": "3.0.0",
|
||||||
"info": {
|
"info": {
|
||||||
"description": "Generates test data in different forms",
|
"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": {
|
"paths": {
|
||||||
"/apis/testdata.datasource.grafana.app/v0alpha1/": {
|
"/apis/testdata.datasource.grafana.app/v0alpha1/": {
|
||||||
|
|||||||
Reference in New Issue
Block a user