From 15a59ac974f4cc09e2a90bab521b0ed43d4eb875 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:26:57 +0100 Subject: [PATCH 1/2] Fix optional types in Help Forum API --- lib/galaxy/schema/help.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/lib/galaxy/schema/help.py b/lib/galaxy/schema/help.py index 67b34e48f16a..ebe2da9370db 100644 --- a/lib/galaxy/schema/help.py +++ b/lib/galaxy/schema/help.py @@ -54,14 +54,16 @@ class HelpForumTopic(Model): archetype: Annotated[Any, Field(description="The archetype of the topic.")] unseen: Annotated[bool, Field(description="Whether the topic is unseen.")] pinned: Annotated[bool, Field(description="Whether the topic is pinned.")] - unpinned: Annotated[Optional[bool], Field(description="Whether the topic is unpinned.")] + unpinned: Annotated[Optional[bool], Field(default=None, description="Whether the topic is unpinned.")] visible: Annotated[bool, Field(description="Whether the topic is visible.")] closed: Annotated[bool, Field(description="Whether the topic is closed.")] archived: Annotated[bool, Field(description="Whether the topic is archived.")] - bookmarked: Annotated[Optional[bool], Field(description="Whether the topic is bookmarked.")] - liked: Annotated[Optional[bool], Field(description="Whether the topic is liked.")] + bookmarked: Annotated[Optional[bool], Field(default=None, description="Whether the topic is bookmarked.")] + liked: Annotated[Optional[bool], Field(default=None, description="Whether the topic is liked.")] tags: Annotated[List[str], Field(description="The tags of the topic.")] - tags_descriptions: Annotated[Optional[Any], Field(description="The descriptions of the tags of the topic.")] + tags_descriptions: Annotated[ + Optional[Any], Field(default=None, description="The descriptions of the tags of the topic.") + ] category_id: Annotated[int, Field(description="The ID of the category of the topic.")] has_accepted_answer: Annotated[bool, Field(description="Whether the topic has an accepted answer.")] @@ -102,10 +104,23 @@ class HelpForumSearchResponse(Model): This model is based on the Discourse API response for the search endpoint. """ - posts: Optional[List[HelpForumPost]] - topics: Optional[List[HelpForumTopic]] - users: Optional[List[HelpForumUser]] - categories: Optional[List[HelpForumCategory]] - tags: Optional[List[HelpForumTag]] - groups: Optional[List[HelpForumGroup]] - grouped_search_result: Optional[HelpForumGroupedSearchResult] + posts: Annotated[List[HelpForumPost], Field(default=None, description="The list of posts returned by the search.")] + topics: Annotated[ + List[HelpForumTopic], Field(default=None, description="The list of topics returned by the search.") + ] + users: Annotated[ + Optional[List[HelpForumUser]], Field(default=None, description="The list of users returned by the search.") + ] + categories: Annotated[ + Optional[List[HelpForumCategory]], + Field(default=None, description="The list of categories returned by the search."), + ] + tags: Annotated[ + Optional[List[HelpForumTag]], Field(default=None, description="The list of tags returned by the search.") + ] + groups: Annotated[ + Optional[List[HelpForumGroup]], Field(default=None, description="The list of groups returned by the search.") + ] + grouped_search_result: Annotated[ + Optional[HelpForumGroupedSearchResult], Field(default=None, description="The grouped search result.") + ] From b33527bf75b6eded5bea15590694d0b7d53ce88a Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:45:14 +0100 Subject: [PATCH 2/2] Update client API schema --- client/src/api/schema/schema.ts | 53 ++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/client/src/api/schema/schema.ts b/client/src/api/schema/schema.ts index 8865c361e282..cb7b0dc21217 100644 --- a/client/src/api/schema/schema.ts +++ b/client/src/api/schema/schema.ts @@ -6656,19 +6656,38 @@ export interface components { * This model is based on the Discourse API response for the search endpoint. */ HelpForumSearchResponse: { - /** Categories */ - categories: components["schemas"]["HelpForumCategory"][] | null; - grouped_search_result: components["schemas"]["HelpForumGroupedSearchResult"] | null; - /** Groups */ - groups: components["schemas"]["HelpForumGroup"][] | null; - /** Posts */ - posts: components["schemas"]["HelpForumPost"][] | null; - /** Tags */ - tags: components["schemas"]["HelpForumTag"][] | null; - /** Topics */ - topics: components["schemas"]["HelpForumTopic"][] | null; - /** Users */ - users: components["schemas"]["HelpForumUser"][] | null; + /** + * Categories + * @description The list of categories returned by the search. + */ + categories?: components["schemas"]["HelpForumCategory"][] | null; + /** @description The grouped search result. */ + grouped_search_result?: components["schemas"]["HelpForumGroupedSearchResult"] | null; + /** + * Groups + * @description The list of groups returned by the search. + */ + groups?: components["schemas"]["HelpForumGroup"][] | null; + /** + * Posts + * @description The list of posts returned by the search. + */ + posts?: components["schemas"]["HelpForumPost"][]; + /** + * Tags + * @description The list of tags returned by the search. + */ + tags?: components["schemas"]["HelpForumTag"][] | null; + /** + * Topics + * @description The list of topics returned by the search. + */ + topics?: components["schemas"]["HelpForumTopic"][]; + /** + * Users + * @description The list of users returned by the search. + */ + users?: components["schemas"]["HelpForumUser"][] | null; }; /** * HelpForumTag @@ -6696,7 +6715,7 @@ export interface components { * Bookmarked * @description Whether the topic is bookmarked. */ - bookmarked: boolean | null; + bookmarked?: boolean | null; /** * Bumped * @description Whether the topic was bumped. @@ -6751,7 +6770,7 @@ export interface components { * Liked * @description Whether the topic is liked. */ - liked: boolean | null; + liked?: boolean | null; /** * Pinned * @description Whether the topic is pinned. @@ -6781,7 +6800,7 @@ export interface components { * Tags Descriptions * @description The descriptions of the tags of the topic. */ - tags_descriptions: Record | null; + tags_descriptions?: Record | null; /** * Title * @description The title of the topic. @@ -6791,7 +6810,7 @@ export interface components { * Unpinned * @description Whether the topic is unpinned. */ - unpinned: boolean | null; + unpinned?: boolean | null; /** * Unseen * @description Whether the topic is unseen.