Skip to content

Commit

Permalink
Allow null in room_types for POST /publicRooms endpoints (#1564)
Browse files Browse the repository at this point in the history
Signed-off-by: Kévin Commaille <[email protected]>
  • Loading branch information
zecakeh committed Jun 13, 2023
1 parent adff3fa commit 49957be
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelogs/client_server/newsfragments/1564.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow `null` in `room_types` in `POST /publicRooms` endpoints schemas.
1 change: 1 addition & 0 deletions changelogs/server_server/newsfragments/1564.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow `null` in `room_types` in `POST /publicRooms` endpoints schemas.
2 changes: 1 addition & 1 deletion data/api/client-server/list_public_rooms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ paths:
type: array
x-addedInMatrixVersion: "1.4"
items:
type: string
type: ["string", "null"]
description: |-
An optional list of [room types](/client-server-api/#types) to search
for. To include rooms without a room type, specify `null` within this
Expand Down
2 changes: 1 addition & 1 deletion data/api/server-server/public_rooms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ paths:
type: array
x-addedInMatrixVersion: "1.4"
items:
type: string
type: ["string", "null"]
description: |-
An optional list of [room types](/client-server-api/#types) to search
for. To include rooms without a room type, specify `null` within this
Expand Down
15 changes: 14 additions & 1 deletion layouts/partials/openapi/render-object-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,24 @@
internal structure, handle this with a bit of recursion
*/}}
{{ $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 */}}

{{ $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 }}
{{ $types = $types | append .type }}
{{ end }}
Expand Down

0 comments on commit 49957be

Please sign in to comment.