mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-26 13:04: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 }}
|
||||
|
||||
{{ 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 }}
|
||||
/* although we expect resolve-allof to be called on the input, resolve-allof does not recurse into
|
||||
* nested objects, so we have to call it again.
|
||||
*/
|
||||
{{ $item = partial "json-schema/resolve-allof" $item }}
|
||||
{{ $additional_objects = partial "json-schema/resolve-additional-types" (dict
|
||||
"schema" $item
|
||||
{{ $additional_objects = partial "get-additional-objects" (dict
|
||||
"this_object" $item
|
||||
"additional_objects" $additional_objects
|
||||
"anchor_base" $anchor_base
|
||||
"name" (printf "%s.oneOf[%d]" $name $idx))
|
||||
}}
|
||||
"name" (printf "%s.oneOf[%d]" $name $idx)
|
||||
) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue