{#- Recursive JSON Schema renderer, styled for Tailwind Typography `prose`. Usage: {% from "partials/api-schema.njk" import schema %} {{ schema(node, apiSpec.schemas) }} `$ref` nodes are rendered as links to /developers/api/reference/schemas/ and never expanded inline, so recursion always terminates. -#} {% macro schema(node, schemas, depth) %} {%- if not node -%}
Not documented.
{%- elif node["$ref"] -%} {%- set name = node["$ref"] | apiRefName -%} {%- if schemas[name] -%}Object {{ name }}.
Object {{ name }}.
| Field | Type | Required | Description |
|---|---|---|---|
{{ key }} |
{%- if refName and schemas[refName] -%}
{{ prop | apiType }}
{%- else -%}
{{ prop | apiType }}
{%- endif -%}
|
{{ "yes" if key in (node.required or []) }} |
{{- prop.description -}}
{%- if nested and not refName -%}
fields{{ schema(prop["items"] if isArray else prop, schemas, (depth or 0) + 1) }} |
Array of:
{{ schema(node["items"], schemas, (depth or 0) + 1) }} {%- else -%}{{ node | apiType }}{% if node.description %} - {{ node.description }}{% endif %}