From 17590be589c19e5f123e0606112b1712557a4771 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Wed, 10 Apr 2024 04:01:14 +0200 Subject: [PATCH] explicitely specified the types for `RoomEntry.type` and `SitesBuildingsEntry.type` --- openapi.yaml | 52 +++++++++++++++++++++++++++--------- webclient/api_types/index.ts | 22 ++++++++++++--- 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 8b7735576..0e485901c 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1714,18 +1714,37 @@ components: - facet - entries RoomEntry: - allOf: - - $ref: '#/components/schemas/SitesBuildingsEntry' - - type: object - required: - - subtext_bold - properties: - subtext_bold: - description: 'Subtext to show below the search (by default in bold and after the non-bold subtext). Usually contains the arch-id of the room, which is another common room id format, and supports highlighting.' - type: string - parsed_id: - description: 'This is an optional feature, that is only supported for some rooms. It might be displayed instead or before the name, to show that a different room id format has matched, that was probably used. See the image below for an example. It will be cropped to a maximum length to not take too much space in UIs. Supports highlighting.' - type: string + type: object + properties: + id: + description: The id of the room + type: string + type: + description: the type of the room + type: string + example: room + enum: + - room + - virtual_room + - poi # unclear if this should be here + name: + description: Subtext to show below the search result. Usually contains the context of where this rooms is located in. Currently not highlighted. + type: string + subtext: + description: Subtext to show below the search result. Usually contains the context of where this rooms is located in. Currently not highlighted. + type: string + subtext_bold: + description: 'Subtext to show below the search (by default in bold and after the non-bold subtext). Usually contains the arch-id of the room, which is another common room id format, and supports highlighting.' + type: string + parsed_id: + description: 'This is an optional feature, that is only supported for some rooms. It might be displayed instead or before the name, to show that a different room id format has matched, that was probably used. See the image below for an example. It will be cropped to a maximum length to not take too much space in UIs. Supports highlighting.' + type: string + required: + - id + - type + - name + - subtext + - subtext_bold SitesBuildingsEntry: type: object properties: @@ -1733,8 +1752,15 @@ components: description: The id of the room type: string type: - description: the type of the room/site/building + description: the type of the site/building type: string + example: campus + enum: + - campus + - building + - area + - site + - joined_building name: description: Subtext to show below the search result. Usually contains the context of where this rooms is located in. Currently not highlighted. type: string diff --git a/webclient/api_types/index.ts b/webclient/api_types/index.ts index 061977fb0..3af738f68 100644 --- a/webclient/api_types/index.ts +++ b/webclient/api_types/index.ts @@ -442,7 +442,19 @@ export type components = { */ readonly n_visible: number; }; - readonly RoomEntry: components["schemas"]["SitesBuildingsEntry"] & { + readonly RoomEntry: { + /** @description The id of the room */ + readonly id: string; + /** + * @description the type of the room + * @example room + * @enum {string} + */ + readonly type: "room" | "virtual_room" | "poi"; + /** @description Subtext to show below the search result. Usually contains the context of where this rooms is located in. Currently not highlighted. */ + readonly name: string; + /** @description Subtext to show below the search result. Usually contains the context of where this rooms is located in. Currently not highlighted. */ + readonly subtext: string; /** @description Subtext to show below the search (by default in bold and after the non-bold subtext). Usually contains the arch-id of the room, which is another common room id format, and supports highlighting. */ readonly subtext_bold: string; /** @description This is an optional feature, that is only supported for some rooms. It might be displayed instead or before the name, to show that a different room id format has matched, that was probably used. See the image below for an example. It will be cropped to a maximum length to not take too much space in UIs. Supports highlighting. */ @@ -451,8 +463,12 @@ export type components = { readonly SitesBuildingsEntry: { /** @description The id of the room */ readonly id: string; - /** @description the type of the room/site/building */ - readonly type: string; + /** + * @description the type of the site/building + * @example campus + * @enum {string} + */ + readonly type: "campus" | "building" | "area" | "site" | "joined_building"; /** @description Subtext to show below the search result. Usually contains the context of where this rooms is located in. Currently not highlighted. */ readonly name: string; /** @description Subtext to show below the search result. Usually contains the context of where this rooms is located in. Currently not highlighted. */