{{/* Renders an inline summary of an OpenAPI schema. Args: dict "schema" $schema "spec" $spec */}} {{- $schema := .schema -}} {{- $spec := .spec -}} {{- /* Resolve $ref */ -}} {{- $ref := index $schema "$ref" -}} {{- if $ref -}} {{- $name := replace $ref "#/components/schemas/" "" -}} {{- $schema = index $spec.components.schemas $name -}}
Schema: {{ $name }}
Array of:
{{- $items := $schema.items -}} {{- $itemsRef := index $items "$ref" -}} {{- if $itemsRef -}} {{- $name := replace $itemsRef "#/components/schemas/" "" -}} {{- $items = index $spec.components.schemas $name -}}{{ $name }}
| Field | Type | Notes |
|---|---|---|
| {{ $name }}{{ if in $required $name }}*{{ end }} | {{- if $propRef -}} {{ replace $propRef "#/components/schemas/" "" }} {{- else if eq $prop.type "array" -}} {{- $itemsRef := index $prop.items "$ref" -}} {{- if $itemsRef -}} {{ replace $itemsRef "#/components/schemas/" "" }}[] {{- else -}} {{ default "any" $prop.items.type }}[] {{- end -}} {{- else -}} {{ default "any" $prop.type }}{{ with $prop.format }} ({{ . }}){{ end }} {{- end -}} {{- if $prop.nullable }} | null{{ end -}} |
{{- with $prop.description }}{{ . }}{{ end -}}
{{- if $prop.readOnly }}read-only{{ end -}}
{{- if $prop.writeOnly }}write-only{{ end -}}
{{- with $prop.enum }}
{{- range . -}}
{{- end -}}
{{ . }}{{- end -}}
|
{{ . }}{{- end -}}
{{ default "any" $schema.type }}
{{- end -}}