github.com/GoogleContainerTools/skaffold/v2@v2.13.2/docs-v2/layouts/shortcodes/schema.html (about) 1 {{ $root := .Get "root" }} 2 {{ if not $root}} 3 {{ errorf "missing value for param 'root': %s" .Position }} 4 {{ end }} 5 6 {{ $version := $.Page.Site.Params.skaffold_version }} 7 {{ $short_version := index (split $version "/") 1 }} 8 {{ $json_schema := printf "schemas/%s.json" $short_version }} 9 {{ if not (fileExists $json_schema)}} 10 {{ errorf "file not found %s at %s" $json_schema .Position }} 11 {{ end }} 12 13 {{ $schema := (readFile $json_schema) | unmarshal }} 14 {{ if not $schema}} 15 {{ errorf "missing json schema: %s" .Position }} 16 {{ end }} 17 18 {{ $definition := index $schema.definitions $root }} 19 20 {{ $showDefaults := false }} 21 {{ range $definition.properties }} 22 {{ if .default }} 23 {{ $showDefaults = true }} 24 {{ end }} 25 {{ end }} 26 27 <style> 28 @media (min-width: 992px) { 29 table { 30 max-width: 80%; 31 } 32 } 33 34 td.desc { 35 width: 100%; 36 } 37 38 td.default { 39 white-space: nowrap; 40 } 41 </style> 42 43 <table> 44 <thead> 45 <tr> 46 <th>Option</th> 47 <th>Description</th> 48 {{ if $showDefaults }}<th>Default</th>{{ end }} 49 </tr> 50 </thead> 51 <tbody> 52 {{range $k := $definition.preferredOrder}} 53 {{ $v := index $definition.properties $k}} 54 55 {{ $isRequired := false }} 56 {{ range $requiredKey := $definition.required }} 57 {{ if eq $requiredKey $k }} 58 {{ $isRequired = true }} 59 {{ end }} 60 {{ end }} 61 62 <tr> 63 <td><code>{{$k}}</code></td> 64 <td class="desc">{{if $isRequired}}<strong>Required</strong> {{end}}{{$v.description | markdownify}}</td> 65 {{ if $showDefaults }}<td class="default"><code>{{ $v.default }}</code></td>{{ end }} 66 </tr> 67 {{end}} 68 </tbody> 69 </table> 70