Scuemata: Add test to validate devenv resources (#35810)
* Add test for devenv resources * Refactor validation tests for grokkability * Devenv dashboards error-tracking script * Refactor to use cueerrors.Details() * Further test refinement * Close major elements of dashboard schema * Centralize dashboard validation tests General dashboard validation testing belongs in the load package. * Better names for error context on glue CUE code * Fixup validate-resource Do only one of base or dist, and fix copied docs. * Skip the devenv test * Remove test for validateResources * Fix shellcheck * Backend linter Co-authored-by: sam boyer <sdboyer@grafana.com>
This commit is contained in:
co-authored by
sam boyer
parent
8de218d5f1
commit
2e0dc835cf
@@ -102,7 +102,11 @@ type genericVersionedSchema struct {
|
||||
|
||||
// Validate checks that the resource is correct with respect to the schema.
|
||||
func (gvs *genericVersionedSchema) Validate(r schema.Resource) error {
|
||||
rv, err := rt.Compile("resource", r.Value)
|
||||
name := r.Name
|
||||
if name == "" {
|
||||
name = "resource"
|
||||
}
|
||||
rv, err := rt.Compile(name, r.Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user