You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
matrix-spec/layouts/shortcodes/http-api.html

27 lines
865 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) "/" }}
{{ partial "openapi/render-api" (dict "api_data" $api_data "base_url" $base_url "path" $path) }}