diff --git a/layouts/partials/events/render-event.html b/layouts/partials/events/render-event.html
index 369a80db..ca1f7837 100644
--- a/layouts/partials/events/render-event.html
+++ b/layouts/partials/events/render-event.html
@@ -56,7 +56,7 @@
Content
{{ $anchor_base := anchorize $event_name }}
-{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $event_data.properties.content "anchor_base" $anchor_base) }}
+{{ $additional_types := index (partial "json-schema/resolve-additional-types" (dict "schema" $event_data.properties.content "anchor_base" $anchor_base)) 1 }}
{{ range $additional_types }}
{{ partial "openapi/render-object-table" . }}
diff --git a/layouts/partials/json-schema/resolve-additional-types.html b/layouts/partials/json-schema/resolve-additional-types.html
index d5dd2692..29a0e6cf 100644
--- a/layouts/partials/json-schema/resolve-additional-types.html
+++ b/layouts/partials/json-schema/resolve-additional-types.html
@@ -11,14 +11,18 @@
Assumes that "resolve-refs" and "resolve-allof" has already been called on the
input schema.
- Returns an array of all the objects found. For each object, the following properties are returned:
- * title
- * properties
- * required
- * enum
- * anchor: a string suitable for using as an html anchor for this object (if `anchor_base` was set, and the object has a title)
+ Returns a pair [$updated_definition, $additional_objects], where:
- Note that the returned array may contain duplicate objects.
+ $updated_definition: TODO
+
+ $additional_objects is an array of all the objects found. For each object, the following properties are returned:
+ * title
+ * properties
+ * required
+ * enum
+ * anchor: a string suitable for using as an html anchor for this object (if `anchor_base` was set, and the object has a title)
+
+ Note that the returned array may contain duplicate objects.
*/}}
@@ -43,13 +47,13 @@
*/}}
{{ if $this_object.additionalProperties }}
{{ if reflect.IsMap $this_object.additionalProperties }}
- {{ $more_objects = partial "get-additional-objects" (dict
+ {{ $res := partial "get-additional-objects" (dict
"this_object" $this_object.additionalProperties
"anchor_base" $anchor_base
"name" (printf "%s.additional" $name)
) }}
{{/* appending an empty slice messes up the types and confuses go, so only do the append if $more_objects is non-empty */}}
- {{ if $more_objects }}
+ {{ with $more_objects := index $res 1 }}
{{ $additional_objects = $additional_objects | append $more_objects }}
{{ end }}
{{ end }}
@@ -59,12 +63,12 @@
Add any nested objects referenced in this object's `properties`
*/}}
{{ range $key, $property := $this_object.properties}}
- {{ $more_objects := partial "get-additional-objects" (dict
+ {{ $res := partial "get-additional-objects" (dict
"this_object" $property
"anchor_base" $anchor_base
"name" (printf "%s.%s" $name $key)
) }}
- {{ if $more_objects }}
+ {{ with $more_objects := index $res 1 }}
{{ $additional_objects = $additional_objects | append $more_objects }}
{{ end }}
{{ end }}
@@ -77,22 +81,22 @@
*/}}
{{ if reflect.IsSlice $this_object.items}}
{{ range $idx, $item := $this_object.items }}
- {{ $more_objects := partial "get-additional-objects" (dict
+ {{ $res := partial "get-additional-objects" (dict
"this_object" $item
"anchor_base" $anchor_base
"name" (printf "%s.items[%d]" $name $idx)
) }}
- {{ if $more_objects }}
+ {{ with $more_objects := index $res 1 }}
{{ $additional_objects = $additional_objects | append $more_objects }}
{{ end }}
{{ end }}
{{ else if reflect.IsMap $this_object.items}}
- {{ $more_objects := partial "get-additional-objects" (dict
+ {{ $res := partial "get-additional-objects" (dict
"this_object" $this_object.items
"anchor_base" $anchor_base
"name" (printf "%s.items" $name)
) }}
- {{ if $more_objects }}
+ {{ with $more_objects := index $res 1 }}
{{ $additional_objects = $additional_objects | append $more_objects }}
{{ end }}
{{ else }}
@@ -100,7 +104,7 @@
{{ end }}
{{ end }}
-{{ return $additional_objects }}
+{{ return slice $this_object $additional_objects }}
{{/*
diff --git a/layouts/partials/openapi/render-request.html b/layouts/partials/openapi/render-request.html
index be39fa38..762cbc89 100644
--- a/layouts/partials/openapi/render-request.html
+++ b/layouts/partials/openapi/render-request.html
@@ -40,7 +40,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" (dict "schema" $schema "anchor_base" $anchor_base) }}
+ {{ $additional_types := index (partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" $anchor_base)) 1 }}
{{ $additional_types = uniq $additional_types }}
{{ range $additional_types }}
{{ partial "openapi/render-object-table" . }}
diff --git a/layouts/partials/openapi/render-responses.html b/layouts/partials/openapi/render-responses.html
index 9c59b0f2..675ef346 100644
--- a/layouts/partials/openapi/render-responses.html
+++ b/layouts/partials/openapi/render-responses.html
@@ -73,7 +73,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" (dict "schema" $schema "anchor_base" $anchor_base) }}
+ {{ $additional_types := index (partial "json-schema/resolve-additional-types" (dict "schema" $schema "anchor_base" $anchor_base)) 1 }}
{{ $additional_types = uniq $additional_types }}
{{ range $additional_types }}
{{ partial "openapi/render-object-table" . }}
diff --git a/layouts/shortcodes/definition.html b/layouts/shortcodes/definition.html
index 2d03179e..894b55b1 100644
--- a/layouts/shortcodes/definition.html
+++ b/layouts/shortcodes/definition.html
@@ -49,7 +49,7 @@
-{{ $additional_types := partial "json-schema/resolve-additional-types" (dict "schema" $definition "name" (printf "\"%s\"" $path)) }}
+{{ $additional_types := index (partial "json-schema/resolve-additional-types" (dict "schema" $definition "name" (printf "\"%s\"" $path))) 1 }}
{{ $additional_types = uniq $additional_types }}
{{ range $additional_types }}
diff --git a/layouts/shortcodes/event-fields.html b/layouts/shortcodes/event-fields.html
index 7120f87f..c14b1dbf 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" (dict "schema" $event) }}
+{{ $additional_types := index (partial "json-schema/resolve-additional-types" (dict "schema" $event)) 1 }}
{{ range $additional_types }}
{{ partial "openapi/render-object-table" . }}
{{end}}