Fix parsing of nested slices in resolve-refs and resolve-allof partials (#2069)
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
parent
60339adb2d
commit
dfc61ffc71
3 changed files with 17 additions and 0 deletions
1
changelogs/internal/newsfragments/2069.clarification
Normal file
1
changelogs/internal/newsfragments/2069.clarification
Normal file
|
@ -0,0 +1 @@
|
|||
Fix parsing of nested slices in `resolve-refs` and `resolve-allof` partials.
|
|
@ -24,6 +24,14 @@
|
|||
|
||||
{{ range $original }}
|
||||
{{ $resolved := partial "json-schema/resolve-allof" . }}
|
||||
{{ if reflect.IsSlice $resolved }}
|
||||
{{/*
|
||||
If $resolved is a slice, `append` will add the items of $resolved to
|
||||
$ret, but we want to add $resolved itself to $ret, so we always wrap
|
||||
it into another slice.
|
||||
*/}}
|
||||
{{ $resolved = slice $resolved }}
|
||||
{{ end }}
|
||||
{{ $ret = $ret | append $resolved }}
|
||||
{{ end }}
|
||||
{{ else if reflect.IsMap $original }}
|
||||
|
|
|
@ -69,6 +69,14 @@
|
|||
|
||||
{{ range $schema }}
|
||||
{{ $resolved := partial "json-schema/resolve-refs" (dict "schema" . "path" $path) }}
|
||||
{{ if reflect.IsSlice $resolved }}
|
||||
{{/*
|
||||
If $resolved is a slice, `append` will add the items of $resolved to
|
||||
$result_slice, but we want to add $resolved itself to $result_slice,
|
||||
so we wrap it into another slice.
|
||||
*/}}
|
||||
{{ $resolved = slice $resolved }}
|
||||
{{ end }}
|
||||
{{ $result_slice = $result_slice | append $resolved }}
|
||||
{{ end }}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue