grafana/pkg/schema/testdata/trimapplydefaults/test4
ying-jeanne a7ea0ca849
refactory to move trim/apply default into schema.go (#33754)
* refactory to move trim/apply default into schema.go

* fix comments

* move schema test outside of load folder
2021-05-12 15:38:00 +08:00

73 lines
1.5 KiB
Plaintext

Verifies common usecases for trimdefault/applydefault functions:
* open structure should be kept when fields not present
-- CUE --
{
templating?: list: [...{...}]
}
-- Full --
{
"templating": {
"list": [
{
"allValue": null,
"current": {
"text": "America",
"value": "America"
},
"datasource": "gdev-postgres",
"definition": "",
"hide": 0,
"includeAll": false,
"label": "Datacenter",
"multi": false,
"name": "datacenter",
"options": [],
"query": "SELECT DISTINCT datacenter FROM grafana_metric",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
}
}
-- Trimed --
{
"templating": {
"list": [
{
"allValue": null,
"current": {
"text": "America",
"value": "America"
},
"datasource": "gdev-postgres",
"definition": "",
"hide": 0,
"includeAll": false,
"label": "Datacenter",
"multi": false,
"name": "datacenter",
"options": [],
"query": "SELECT DISTINCT datacenter FROM grafana_metric",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 1,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
}
}