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

This commit is contained in:
sam boyer 2021-05-03 13:24:28 -04:00 committed by GitHub
parent d6cff74d5a
commit 806761fe70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

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
}

View File

@ -14,7 +14,6 @@ Family: {
folderId?: int
tags: [...string] | *[]
},
PanelFieldConfig: {}
}
]
]

View File

@ -8,8 +8,7 @@ Family: {
// empty/missing will default to grafana blog
feedUrl?: string
useProxy?: bool
},
PanelFieldConfig: {}
}
}
]
]

View File

@ -14,8 +14,6 @@ Family: {
For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)
"""
}
PanelFieldConfig: {}
}
]
]