diff --git a/layouts/partials/json-schema/resolve-examples.html b/layouts/partials/json-schema/resolve-examples.html index a0bb7090..dd126540 100644 --- a/layouts/partials/json-schema/resolve-examples.html +++ b/layouts/partials/json-schema/resolve-examples.html @@ -37,6 +37,11 @@ {{ end }} {{ end }} + {{/* + Add the assembled example to the list if either (a) the example is + non-empty, or (b) the object itself is meant to be empty (so an + empty example is correct). + */}} {{ if (or $example (not $this_object.properties)) }} {{ $examples = slice $example }} {{ end }} diff --git a/layouts/partials/openapi/render-media-type-objects.html b/layouts/partials/openapi/render-media-type-objects.html index 9cfe62a7..7c48320e 100644 --- a/layouts/partials/openapi/render-media-type-objects.html +++ b/layouts/partials/openapi/render-media-type-objects.html @@ -17,6 +17,11 @@ */}} +{{/* + 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 }} {{/* @@ -48,9 +53,10 @@ {{ end }} {{/* - Render object tables for any objects referenced in the response. + Render object tables for any objects referenced in the request/response. - This will be a no-op for response types which aren't objects or arrays. + This will be a no-op for request/response body types which aren't + objects or arrays. */}} {{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" .anchor_base) }} {{ range $additional_types }}