api: Validate dashboards on save via coremodels, behind feature toggle (#48252)

* Add coremodelValidation feature flag

* coremodels: use stubs when feature flag is off

* api: validate dashboards on save

* Need pointer receiver for FeatureManager

* Update dashboard Go model

* Align doc comments

* Include CoremodelRegistry in test

* Wedge coremodel in on all test cases, ugh

* Ugh fix comment again

* Update pkg/framework/coremodel/staticregistry/provide.go

Co-authored-by: Artur Wierzbicki <wierzbicki.artur.94@gmail.com>

* Update Thema (and its deps) for better errs

* omg whitespace

Co-authored-by: Artur Wierzbicki <wierzbicki.artur.94@gmail.com>
This commit is contained in:
sam boyer
2022-05-21 20:44:12 -04:00
committed by GitHub
parent 03fe1435a0
commit a3402641d6
11 changed files with 111 additions and 15 deletions

View File

@@ -243,5 +243,11 @@ var (
Description: "Enable streaming JSON parser for Prometheus datasource",
State: FeatureStateAlpha,
},
{
Name: "validateDashboardsOnSave",
Description: "Validate dashboard JSON POSTed to api/dashboards/db",
State: FeatureStateAlpha,
RequiresRestart: true,
},
}
)

View File

@@ -178,4 +178,8 @@ const (
// FlagPrometheusStreamingJSONParser
// Enable streaming JSON parser for Prometheus datasource
FlagPrometheusStreamingJSONParser = "prometheusStreamingJSONParser"
// FlagValidateDashboardsOnSave
// Validate dashboard JSON POSTed to api/dashboards/db
FlagValidateDashboardsOnSave = "validateDashboardsOnSave"
)