Delay addition of $this_object to result array

... so that we have a chance to modify it first.
This commit is contained in:
Richard van der Hoff 2024-02-13 18:33:02 +00:00
parent 83bbc23e30
commit 8e004b1d31

View file

@ -70,9 +70,6 @@
{{ $this_object = merge $this_object (dict "anchor" (printf "%s_%s" $anchor_base (anchorize $this_object.title))) }} {{ $this_object = merge $this_object (dict "anchor" (printf "%s_%s" $anchor_base (anchorize $this_object.title))) }}
{{ end }} {{ end }}
/* Add the object we were passed into the $all_objects array */
{{ $all_objects = $all_objects | append $this_object }}
/* Add any nested objects referenced in this object's `additionalProperties` */ /* Add any nested objects referenced in this object's `additionalProperties` */
{{ if $this_object.additionalProperties }} {{ if $this_object.additionalProperties }}
{{ if reflect.IsMap $this_object.additionalProperties }} {{ if reflect.IsMap $this_object.additionalProperties }}
@ -106,6 +103,13 @@
"name" (printf "%s.%s" $name $key) "name" (printf "%s.%s" $name $key)
) }} ) }}
{{ end }} {{ end }}
/* Finally, prepend the object we were passed onto the $all_objects array */
{{ $tmp := slice $this_object }}
{{ if $all_objects }}
{{ $tmp = $tmp | append $all_objects }}
{{ end }}
{{ $all_objects = $tmp }}
{{ end }} {{ end }}
{{ if eq $this_object.type "array" }} {{ if eq $this_object.type "array" }}