update openapi specs
This commit is contained in:
@@ -159,7 +159,8 @@ func (b *DataSourceAPIBuilder) PostProcessOpenAPI(oas *spec3.OpenAPI) (*spec3.Op
|
||||
if op.Extensions == nil {
|
||||
op.Extensions = make(spec.Extensions)
|
||||
}
|
||||
op.OperationId = fmt.Sprintf("%s_route%s", strings.ToLower(m), strings.ReplaceAll(k, "/", "_"))
|
||||
tmp := strings.ReplaceAll(strings.ReplaceAll(k, "{", ""), "}", "")
|
||||
op.OperationId = fmt.Sprintf("%s_route%s", strings.ToLower(m), strings.ReplaceAll(tmp, "/", "_"))
|
||||
}
|
||||
}
|
||||
oas.Paths.Paths[prefix+k] = v
|
||||
|
||||
@@ -67,8 +67,11 @@ func RegisterAPIService(
|
||||
// We want to expose just a limited set of plugins
|
||||
explicitPluginList := features.IsEnabledGlobally(featuremgmt.FlagDatasourceAPIServers)
|
||||
|
||||
// Requires dev-mode
|
||||
configCrudUseNewApis := features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs)
|
||||
|
||||
// This requires devmode!
|
||||
if !explicitPluginList && !features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs) {
|
||||
if !explicitPluginList && !configCrudUseNewApis {
|
||||
return nil, nil // skip registration unless opting into experimental apis
|
||||
}
|
||||
|
||||
@@ -84,6 +87,12 @@ func RegisterAPIService(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// This client can talk to any plugin
|
||||
client, ok := pluginClient.(PluginClient)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("plugin client is not a PluginClient: %T", pluginClient)
|
||||
}
|
||||
|
||||
ids := []string{
|
||||
"grafana-testdata-datasource",
|
||||
"prometheus",
|
||||
@@ -103,18 +112,13 @@ func RegisterAPIService(
|
||||
continue // skip non-datasource plugins
|
||||
}
|
||||
|
||||
client, ok := pluginClient.(PluginClient)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("plugin client is not a PluginClient: %T", pluginClient)
|
||||
}
|
||||
|
||||
builder, err = NewDataSourceAPIBuilder(pluginJSON,
|
||||
client,
|
||||
datasources.GetDatasourceProvider(pluginJSON),
|
||||
contextProvider,
|
||||
accessControl,
|
||||
features.IsEnabledGlobally(featuremgmt.FlagDatasourceQueryTypes),
|
||||
false,
|
||||
configCrudUseNewApis,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -122,7 +126,8 @@ func RegisterAPIService(
|
||||
|
||||
// Hardcoded schemas for testdata
|
||||
// NOTE: this will be driven by the pluginJSON/manifest soon
|
||||
if "grafana-testdata-datasource" == pluginJSON.ID {
|
||||
if pluginJSON.ID == "grafana-testdata-datasource" &&
|
||||
features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs) {
|
||||
builder.schemaProvider = hardcoded.TestdataOpenAPIExtension
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user