diff --git a/changelogs/client_server/newsfragments/1564.clarification b/changelogs/client_server/newsfragments/1564.clarification new file mode 100644 index 00000000..59fcf699 --- /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 00000000..59fcf699 --- /dev/null +++ b/changelogs/server_server/newsfragments/1564.clarification @@ -0,0 +1 @@ +Allow `null` in `room_types` in `POST /publicRooms` endpoints schemas. diff --git a/data/api/client-server/list_public_rooms.yaml b/data/api/client-server/list_public_rooms.yaml index e4f0551b..ba816b06 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 dd909f8f..c81789ae 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 5c38be87..4fc5ac76 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 }}