From 3b54ec5f9660d81041760137bad90cae8e8ec41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 10 Jun 2023 11:58:45 +0200 Subject: [PATCH 1/2] Allow null in room_types for POST /publicRooms endpoints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kévin Commaille --- data/api/client-server/list_public_rooms.yaml | 2 +- data/api/server-server/public_rooms.yaml | 2 +- layouts/partials/openapi/render-object-table.html | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/data/api/client-server/list_public_rooms.yaml b/data/api/client-server/list_public_rooms.yaml index e4f0551b8..ba816b06c 100644 --- a/data/api/client-server/list_public_rooms.yaml +++ b/data/api/client-server/list_public_rooms.yaml @@ -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 diff --git a/data/api/server-server/public_rooms.yaml b/data/api/server-server/public_rooms.yaml index dd909f8f1..c81789ae4 100644 --- a/data/api/server-server/public_rooms.yaml +++ b/data/api/server-server/public_rooms.yaml @@ -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 diff --git a/layouts/partials/openapi/render-object-table.html b/layouts/partials/openapi/render-object-table.html index 5c38be87a..4fc5ac767 100644 --- a/layouts/partials/openapi/render-object-table.html +++ b/layouts/partials/openapi/render-object-table.html @@ -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 }} From 4ce6846ec5e5485db7c62ffa0f14ce3b0af63eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 10 Jun 2023 12:01:52 +0200 Subject: [PATCH 2/2] Add changelogs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kévin Commaille --- changelogs/client_server/newsfragments/1564.clarification | 1 + changelogs/server_server/newsfragments/1564.clarification | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelogs/client_server/newsfragments/1564.clarification create mode 100644 changelogs/server_server/newsfragments/1564.clarification diff --git a/changelogs/client_server/newsfragments/1564.clarification b/changelogs/client_server/newsfragments/1564.clarification new file mode 100644 index 000000000..59fcf699e --- /dev/null +++ b/changelogs/client_server/newsfragments/1564.clarification @@ -0,0 +1 @@ +Allow `null` in `room_types` in `POST /publicRooms` endpoints schemas. diff --git a/changelogs/server_server/newsfragments/1564.clarification b/changelogs/server_server/newsfragments/1564.clarification new file mode 100644 index 000000000..59fcf699e --- /dev/null +++ b/changelogs/server_server/newsfragments/1564.clarification @@ -0,0 +1 @@ +Allow `null` in `room_types` in `POST /publicRooms` endpoints schemas.