diff --git a/layouts/partials/events/render-event.html b/layouts/partials/events/render-event.html index 66e15db7..15e8aa5a 100644 --- a/layouts/partials/events/render-event.html +++ b/layouts/partials/events/render-event.html @@ -53,7 +53,7 @@

Content

-{{ $additional_types := partial "json-schema/resolve-additional-types" $event_data.properties.content }} +{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $event_data.properties.content) }} {{ range $additional_types }} {{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }} diff --git a/layouts/partials/json-schema/resolve-additional-types.html b/layouts/partials/json-schema/resolve-additional-types.html index a979cf1a..f3a5413b 100644 --- a/layouts/partials/json-schema/resolve-additional-types.html +++ b/layouts/partials/json-schema/resolve-additional-types.html @@ -1,11 +1,9 @@ {{/* - Finds and returns all nested objects, given: + Finds and returns all nested objects, given a dict containing: + * `schema`: a JSON schema object - * `this_object`: a JSON schema object - - Given a schema object, this template finds all nested objects under that - schema. + This template finds all nested objects inside `schema`. Assumes that "resolve-refs" and "resolve-allof" has already been called on the input schema. @@ -19,7 +17,7 @@ */}} -{{ $this_object := . }} +{{ $this_object := .schema }} {{ $additional_objects := slice }} {{ if eq $this_object.type "object" }} @@ -79,7 +77,7 @@ */ {{ $this_object := partial "json-schema/resolve-allof" .this_object }} - {{ $more_objects := partial "json-schema/resolve-additional-types" $this_object }} + {{ $more_objects := partial "json-schema/resolve-additional-types" (dict "schema" $this_object) }} {{/* As far as I know we don't have something like Array.concat(), so add them one at a time */}} diff --git a/layouts/partials/openapi/render-request.html b/layouts/partials/openapi/render-request.html index 5e801299..d0383058 100644 --- a/layouts/partials/openapi/render-request.html +++ b/layouts/partials/openapi/render-request.html @@ -38,7 +38,7 @@ {{ $schema := partial "json-schema/resolve-refs" (dict "schema" $body_parameter.schema "path" $path) }} {{ $schema := partial "json-schema/resolve-allof" $schema }} - {{ $additional_types := partial "json-schema/resolve-additional-types" $schema }} + {{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema) }} {{ $additional_types = uniq $additional_types }} {{ range $additional_types }} {{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }} diff --git a/layouts/partials/openapi/render-responses.html b/layouts/partials/openapi/render-responses.html index 79636945..38ca7aeb 100644 --- a/layouts/partials/openapi/render-responses.html +++ b/layouts/partials/openapi/render-responses.html @@ -71,7 +71,7 @@ response. (This will be a no-op for response types which aren't objects or arrays.) */}} - {{ $additional_types := partial "json-schema/resolve-additional-types" $schema }} + {{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $schema) }} {{ $additional_types = uniq $additional_types }} {{ range $additional_types }} {{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }} diff --git a/layouts/shortcodes/definition.html b/layouts/shortcodes/definition.html index 2e000c73..518d094c 100644 --- a/layouts/shortcodes/definition.html +++ b/layouts/shortcodes/definition.html @@ -45,7 +45,7 @@ -{{ $additional_types := partial "json-schema/resolve-additional-types" $definition }} +{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $definition) }} {{ $additional_types = uniq $additional_types }} {{ range $additional_types }} diff --git a/layouts/shortcodes/event-fields.html b/layouts/shortcodes/event-fields.html index 83651c21..135acab0 100644 --- a/layouts/shortcodes/event-fields.html +++ b/layouts/shortcodes/event-fields.html @@ -35,7 +35,7 @@ {{ $event = merge $event (dict "title" "") }} -{{ $additional_types := partial "json-schema/resolve-additional-types" $event }} +{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $event) }} {{ range $additional_types }} {{ partial "openapi/render-object-table" (dict "caption" .title "properties" .properties "required" .required) }} {{end}}