diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index 21a185e3..85597e14 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -107,26 +107,27 @@ {{ end }} - {{/* additionalProperties should either be an OpenAPI schema object, or a - boolean. If it's the former, look for a `description` and render it as a note. - If it's `true`, do nothing. If it's `false`, raise a build-time error: - "Everything is extensible in Matrix unless otherwise noted". */}} - {{ if (ne $additionalProperties nil )}} + {{/* If additionalProperties is true, do nothing. + If additionalProperties is nil, treat is as the default (true) and do nothing. + If additionalProperties is false, raise a build-time error: + "Everything is extensible in Matrix unless otherwise noted". + Otherwise, it should be an OpenAPI schema object. Include the description + of that schema object, if it exists. */}} + {{ if (and (ne $additionalProperties nil) (ne $additionalProperties true)) }} + {{ if (and (reflect.IsMap $additionalProperties)) -}} + {{ if (index $additionalProperties "description") -}} - {{ if (and (reflect.IsMap $additionalProperties)) -}} - {{ if (index $additionalProperties "description") -}} -Notes on additional properties: {{ $additionalProperties.description }} - {{ end }} - {{/* TODO: should we handle the case where additional properties are - permitted, but must follow an explicit schema? */}} - {{ else if (not $additionalProperties) -}} - {{ errorf "Unexpected additionalProperties=false for %s" $title }} -May **not** have additional properties. - {{ end }} + Notes on additional properties: {{ $additionalProperties.description }} - {{ end }} + {{ end }} + {{/* TODO: should we handle the case where additional properties are + permitted, but must follow an explicit schema? */}} + {{ else if (not $additionalProperties) -}} + {{ errorf "Unexpected additionalProperties=false for %s" $title }} + {{ end }} + {{ end }} {{ end }}