mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-23 19:44:09 +01:00
Call it right after accessing the site.Data, since it is recursing it will solve all references in the tree. That way we don't need to wonder where to call it, we trust the validators that the refs will be used in the right place. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
30 lines
1,010 B
HTML
30 lines
1,010 B
HTML
{{/*
|
|
|
|
This template is used to render an HTTP API, given an OpenAPI definition.
|
|
|
|
It expects to be passed two parameters:
|
|
|
|
* a `spec` parameter identifying the spec, which must be the name of
|
|
a directory under /data/api
|
|
* an `api` parameter, identifying an OpenAPI definition,
|
|
which is the name of a schema file under "data/api/$spec".
|
|
The file extension is omitted. For example:
|
|
|
|
{{% http-api spec="server-server" api="public_rooms" %}}
|
|
|
|
This template replaces the old {{*_http_api}} template.
|
|
|
|
*/}}
|
|
|
|
{{ $spec := .Params.spec}}
|
|
{{ $api := .Params.api}}
|
|
|
|
{{ $api_data := index .Site.Data.api .Params.spec .Params.api }}
|
|
{{ $base_url := (index $api_data.servers 0).variables.basePath.default }}
|
|
{{ $path := delimit (slice "api" $spec $api) "/" }}
|
|
|
|
{{ $api_data = partial "json-schema/resolve-refs" (dict "schema" $api_data "path" $path) }}
|
|
{{ $api_data := partial "json-schema/resolve-allof" $api_data }}
|
|
|
|
{{ partial "openapi/render-api" (dict "api_data" $api_data "base_url" $base_url) }}
|