From f3130f70e601fe0446ad43c9a028cb29a753bafe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= <76261501+zecakeh@users.noreply.github.com> Date: Tue, 26 Nov 2024 18:51:24 +0100 Subject: [PATCH] Fix regression introduced when inlining "Required" (#2005) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the description is not set in the object definition, Hugo generates a weird string after "Required": `%!s()`. To avoid that, we default the description to an empty string when it is not set. Signed-off-by: Kévin Commaille --- changelogs/internal/newsfragments/2005.clarification | 1 + layouts/partials/openapi/render-object-table.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelogs/internal/newsfragments/2005.clarification diff --git a/changelogs/internal/newsfragments/2005.clarification b/changelogs/internal/newsfragments/2005.clarification new file mode 100644 index 00000000..db9e1a1a --- /dev/null +++ b/changelogs/internal/newsfragments/2005.clarification @@ -0,0 +1 @@ +Enforce consistent vertical spacing between paragraphs in endpoint definitions. \ No newline at end of file diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index bae7a3d9..08dd5790 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -313,7 +313,7 @@ resolve-additional-types.) Prepend "Required:" to make it part of the first paragraph of the description. */}} - {{- $description = printf "Required: %s" $description -}} + {{- $description = printf "Required: %s" (default "" $description) -}} {{ end -}} {{/* Force the rendering as a block so the description is always inside a