{{/* Render a map of [Media Type Objects](https://spec.openapis.org/oas/v3.1.1#media-type-object). This map can be found as the `content` field of requests and responses. Parameters: * `content`: A map of MIME type to Media Type Object * `kind`: the kind of object that is rendered, either `request` or `response`. * `anchor_base`: a prefix to add to the HTML anchors generated for each object This template renders: * Object tables if the map contains an `application/json` MIME type, or a table with the MIME types and the corresponding description of the object. * The examples of the Media Type Objects. */}} {{/* Request and response bodies can have several content types. If there is a JSON type, we display that; otherwise we just show the content types and descriptions. */}} {{ $json_body := index .content "application/json" }} {{ if $json_body }} {{/* Display the JSON schemas */}} {{ $schema := $json_body.schema }} {{/* All this is to work out how to express the content of the response in the case where it is an array. */}} {{ if eq $schema.type "array" }} {{ $type_of := "" }} {{ if $schema.items.anyOf }} {{ $types := slice }} {{ range $schema.items.anyOf }} {{ if .title }} {{ $types = $types | append .title}} {{ else }} {{ $types = $types | append .type }} {{ end }} {{ end }} {{ $type_of = delimit $types ", "}} {{ else }} {{ $type_of = $schema.items.title }} {{ end }}
Array of {{ $type_of }}.