forked from grafana/dashboard-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs.tmpl
80 lines (67 loc) · 2.38 KB
/
docs.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Docs
* [dashboard](#dashboard)
* [panel](#panel)
{{- range $name, $schema := .Panel.Properties}}
* [{{inflectJoin $name "new"}}](#{{printf "panel%snew" $name}})
{{- end}}
* [target](#target)
{{- range $name, $schema := .Target.Properties}}
* [{{inflectJoin $name "new"}}](#{{printf "target%snew" $name}})
{{- end}}
* [template](#template)
{{- range $name, $schema := .Template.Properties}}
* [{{inflectJoin $name "new"}}](#{{printf "template%snew" $name}})
{{- end}}
{{- define "schema"}}
{{range $name, $schema := .TopLevelSimpleProperties}}
* **{{objectInflection ($schema.HumanName $name)}}**: (type: {{$schema.Type}}, default: `{{$schema.DefaultJSON}}`)
{{$schema.Description | indent 2}}
{{- end}}
{{range $methodName, $schema := .TopLevelObjectProperties}}
{{- if gt (len $schema.NestedSimpleProperties) 0}}
#### #{{objectInflection (printf "set %s" ($schema.HumanName $methodName))}}
{{range $fs := $schema.NestedSimpleProperties}}
* **{{objectInflection ($fs.Schema.HumanName $fs.Name)}}**: (type: {{$fs.Schema.Type}}, default: `{{$fs.Schema.DefaultJSON}}`)
{{$fs.Schema.Description | indent 2}}
{{- end}}
{{- end}}
{{- end}}
{{range $fs := .NestedComplexArrayProperties}}
#### #{{singularize (objectInflection (printf "add %s" ($fs.Schema.HumanName $fs.Name)))}}
{{if eq (len $fs.Schema.Items.Properties) 0}}
* **{{singularize (objectInflection ($fs.Schema.HumanName $fs.Name))}}**: (type: {{$fs.Schema.Items.Type}})
{{$fs.Schema.Description | indent 2}}
{{- else}}
{{- range $name, $schema := $fs.Schema.Items.Properties}}
* **{{objectInflection ($schema.HumanName $name)}}**: (type: {{$schema.Type}}, default: `{{$schema.DefaultJSON}}`)
{{$schema.Description | indent 2}}
{{- end}}
{{- end}}
{{- end}}
{{end}}
## dashboard
{{.Dashboard.Description}}
### {{inflectJoin "dashboard" "new"}}
Instantiate a dashboard.
{{- template "schema" .Dashboard}}
## panel
{{.Panel.Description}}
{{range $name, $schema := .Panel.Properties}}
### {{inflectJoin "panel" $name "new"}}
{{$schema.Description}}
{{template "schema" $schema}}
{{end}}
## target
{{.Target.Description}}
{{range $name, $schema := .Target.Properties}}
### {{inflectJoin "target" $name "new"}}
{{$schema.Description}}
{{template "schema" $schema}}
{{end}}
## template
{{.Template.Description}}
{{range $name, $schema := .Template.Properties}}
### {{inflectJoin "tamplate" $name "new"}}
{{$schema.Description}}
{{template "schema" $schema}}
{{end}}