Schema: Change Subsume check so optionality is respected (#33650)

This commit is contained in:
sam boyer
2021-05-03 10:24:28 -07:00
committed by GitHub
parent d6cff74d5a
commit 806761fe70
4 changed files with 7 additions and 7 deletions
+6 -2
View File
@@ -58,7 +58,10 @@ func mapPanelModel(id string, vcs schema.VersionedCueSchema) cue.Value {
panelSchema: maj: in.v.maj
panelSchema: min: in.v.min
options: in.model.PanelOptions
fieldConfig: defaults: custom: in.model.PanelFieldConfig
fieldConfig: defaults: custom: {}
if in.model.PanelFieldConfig != _|_ {
fieldConfig: defaults: custom: in.model.PanelFieldConfig
}
}
`, id, maj, min))
@@ -140,7 +143,8 @@ func readPanelModels(p BaseLoadPaths) (map[string]schema.VersionedCueSchema, err
}
// Ensure the declared value is subsumed by/correct wrt #PanelFamily
if err := pmf.Subsume(pmod); err != nil {
// TODO not actually sure that Final is what we want here.
if err := pmf.Subsume(pmod, cue.Final()); err != nil {
return err
}
@@ -14,7 +14,6 @@ Family: {
folderId?: int
tags: [...string] | *[]
},
PanelFieldConfig: {}
}
]
]
+1 -2
View File
@@ -8,8 +8,7 @@ Family: {
// empty/missing will default to grafana blog
feedUrl?: string
useProxy?: bool
},
PanelFieldConfig: {}
}
}
]
]
-2
View File
@@ -14,8 +14,6 @@ Family: {
For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)
"""
}
PanelFieldConfig: {}
}
]
]