Fix the rendering of the event format for room versions 1 and 2 (#1883)

* Fix rendering of array with items using anyOf

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Use a single definition for Event Hash

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Add changelog

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

* Add ending newline

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>

---------

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille 2024-06-20 17:39:44 +02:00 committed by GitHub
parent 094e25b6cd
commit bd20d946c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 33 additions and 63 deletions

View file

@ -117,6 +117,9 @@ resolve-additional-types.)
* `oneOf`: optional array of dictionaries describing the different formats
that the property can have
* `anyOf`: optional array of dictionaries describing the different formats
that the property can have
* `properties`: if the type is an object, optional dictionary for
well-defined properties, each given as: `property_name` : `property_data`
@ -158,13 +161,14 @@ resolve-additional-types.)
{{ $type = . }}
{{ end }}
{{ end }}
{{ else if or (reflect.IsSlice .type) .oneOf }}
{{ else if or (reflect.IsSlice .type) .oneOf .anyOf }}
{{/*
It's legal to specify an array of types.
There are two ways to do that:
There are three ways to do that:
- Use an array of strings.
- Use oneOf, with items having a schema.
- Use anyOf, with items having a schema.
Join them together in that case, like `type|other_type`.
*/}}
@ -174,6 +178,10 @@ resolve-additional-types.)
{{ range .oneOf }}
{{ $types = $types | append (partial "property-type" .) }}
{{ end }}
{{ else if .anyOf }}
{{ range .anyOf }}
{{ $types = $types | append (partial "property-type" .) }}
{{ end }}
{{ else }}
{{ range .type }}
{{ $types = $types | append (htmlEscape .) }}