mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-26 04:54:10 +01:00
render-object-table: take a "title" rather than a "caption"
... which means we can use the result from resolve-additional-types directly.
This commit is contained in:
parent
c508f1e917
commit
1ed4e40362
|
|
@ -56,7 +56,7 @@
|
||||||
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $event_data.properties.content) }}
|
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $event_data.properties.content) }}
|
||||||
|
|
||||||
{{ range $additional_types }}
|
{{ range $additional_types }}
|
||||||
{{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }}
|
{{ partial "openapi/render-object-table" . }}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<h2>Examples</h2>
|
<h2>Examples</h2>
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,25 @@
|
||||||
|
|
||||||
Render a table listing the properties of an object, given:
|
Render a table listing the properties of an object, given:
|
||||||
|
|
||||||
* `caption`: optional caption for the table
|
* `title`: optional caption for the table
|
||||||
|
|
||||||
* `properties`: dictionary of the properties to list, each given as:
|
* `properties`: dictionary of the properties to list, each given as:
|
||||||
`property_name` : `property_data`
|
`property_name` : `property_data`
|
||||||
|
|
||||||
* `required`: array containing the names of required properties.
|
* `required`: array containing the names of required properties.
|
||||||
In some cases (such as response body specifications) this isn't used, and
|
In some cases (such as response body specifications) this isn't used, and
|
||||||
instead properties have a `required` boolean attribute. We support this too.
|
instead properties have a `required` boolean attribute. We support this too.
|
||||||
|
|
||||||
*/}}
|
*/}}
|
||||||
|
|
||||||
{{ $caption := .caption }}
|
{{ $title := .title }}
|
||||||
{{ $properties := .properties}}
|
{{ $properties := .properties}}
|
||||||
{{ $required := .required}}
|
{{ $required := .required}}
|
||||||
|
|
||||||
{{ if $properties }}
|
{{ if $properties }}
|
||||||
|
|
||||||
<table class>
|
<table class>
|
||||||
{{ with $caption }}
|
{{ with $title }}
|
||||||
<caption>{{ . }}</caption>
|
<caption>{{ . }}</caption>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,6 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{/* and render the parameters */}}
|
{{/* and render the parameters */}}
|
||||||
{{ partial "openapi/render-object-table" (dict "caption" $caption "properties" $param_dict) }}
|
{{ partial "openapi/render-object-table" (dict "title" $caption "properties" $param_dict) }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema) }}
|
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema) }}
|
||||||
{{ $additional_types = uniq $additional_types }}
|
{{ $additional_types = uniq $additional_types }}
|
||||||
{{ range $additional_types }}
|
{{ range $additional_types }}
|
||||||
{{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }}
|
{{ partial "openapi/render-object-table" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<h3>Request body example</h3>
|
<h3>Request body example</h3>
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema) }}
|
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema) }}
|
||||||
{{ $additional_types = uniq $additional_types }}
|
{{ $additional_types = uniq $additional_types }}
|
||||||
{{ range $additional_types }}
|
{{ range $additional_types }}
|
||||||
{{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }}
|
{{ partial "openapi/render-object-table" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
{{ $additional_types = uniq $additional_types }}
|
{{ $additional_types = uniq $additional_types }}
|
||||||
|
|
||||||
{{ range $additional_types }}
|
{{ range $additional_types }}
|
||||||
{{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }}
|
{{ partial "openapi/render-object-table" . }}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<h2>Examples</h2>
|
<h2>Examples</h2>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $event) }}
|
{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $event) }}
|
||||||
{{ range $additional_types }}
|
{{ range $additional_types }}
|
||||||
{{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }}
|
{{ partial "openapi/render-object-table" . }}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue