Allow `null` in `room_types` for `POST /publicRooms` endpoints (#1564)

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
pull/1578/head
Kévin Commaille 1 year ago committed by GitHub
parent adff3faa35
commit 49957be1e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1 @@
Allow `null` in `room_types` in `POST /publicRooms` endpoints schemas.

@ -0,0 +1 @@
Allow `null` in `room_types` in `POST /publicRooms` endpoints schemas.

@ -214,7 +214,7 @@ paths:
type: array type: array
x-addedInMatrixVersion: "1.4" x-addedInMatrixVersion: "1.4"
items: items:
type: string type: ["string", "null"]
description: |- description: |-
An optional list of [room types](/client-server-api/#types) to search An optional list of [room types](/client-server-api/#types) to search
for. To include rooms without a room type, specify `null` within this for. To include rooms without a room type, specify `null` within this

@ -107,7 +107,7 @@ paths:
type: array type: array
x-addedInMatrixVersion: "1.4" x-addedInMatrixVersion: "1.4"
items: items:
type: string type: ["string", "null"]
description: |- description: |-
An optional list of [room types](/client-server-api/#types) to search An optional list of [room types](/client-server-api/#types) to search
for. To include rooms without a room type, specify `null` within this for. To include rooms without a room type, specify `null` within this

@ -102,11 +102,24 @@
internal structure, handle this with a bit of recursion internal structure, handle this with a bit of recursion
*/}} */}}
{{ $type = delimit (slice "{string: " (partial "type-or-title" .additionalProperties) "}" ) "" }} {{ $type = delimit (slice "{string: " (partial "type-or-title" .additionalProperties) "}" ) "" }}
{{ else if and .oneOf (reflect.IsSlice .oneOf) }} {{ else if reflect.IsSlice .type }}
{{/* It's legal to specify an array of types. Join them together in that case */}} {{/* It's legal to specify an array of types. Join them together in that case */}}
{{ $types := slice }} {{ $types := slice }}
{{ range .type }}
{{ $types = $types | append . }}
{{ end }}
{{ $type = delimit $types "|" }}
{{ else if and .oneOf (reflect.IsSlice .oneOf) }}
{{/*
This is like an array of types except some of the types probably have a schema.
Join them together too.
*/}}
{{ $types := slice }}
{{ range .oneOf }} {{ range .oneOf }}
{{ $types = $types | append .type }} {{ $types = $types | append .type }}
{{ end }} {{ end }}

Loading…
Cancel
Save