mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-26 04:54:10 +01:00
Fix and simplify oneOf branch
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
parent
33440233c2
commit
405b3efbbb
|
|
@ -91,17 +91,18 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if and $this_object.oneOf (reflect.IsSlice $this_object.oneOf) }}
|
{{/*
|
||||||
|
Handle object schemas using the `oneOf` keyword
|
||||||
|
(https://json-schema.org/understanding-json-schema/reference/combining.html#oneof)
|
||||||
|
*/}}
|
||||||
|
{{ if $this_object.oneOf }}
|
||||||
{{ range $idx, $item := $this_object.oneOf }}
|
{{ range $idx, $item := $this_object.oneOf }}
|
||||||
/* although we expect resolve-allof to be called on the input, resolve-allof does not recurse into
|
{{ $additional_objects = partial "get-additional-objects" (dict
|
||||||
* nested objects, so we have to call it again.
|
"this_object" $item
|
||||||
*/
|
"additional_objects" $additional_objects
|
||||||
{{ $item = partial "json-schema/resolve-allof" $item }}
|
|
||||||
{{ $additional_objects = partial "json-schema/resolve-additional-types" (dict
|
|
||||||
"schema" $item
|
|
||||||
"anchor_base" $anchor_base
|
"anchor_base" $anchor_base
|
||||||
"name" (printf "%s.oneOf[%d]" $name $idx))
|
"name" (printf "%s.oneOf[%d]" $name $idx)
|
||||||
}}
|
) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue