Skip to content

Commit

Permalink
Make all fields optional for HelpForumPost
Browse files Browse the repository at this point in the history
Unfortunately, the OpenAPI schema of Discourse (https://docs.discourse.org/openapi.json) does not specify the proper type for posts in the "/search.json" response.

There is at least one case where the post name is null (https://help.galaxyproject.org//search.json?q=tags:circos+tool-help%20status:solved) so let's play safe.
  • Loading branch information
davelopez committed Sep 17, 2024
1 parent a567944 commit 52f3445
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7031,17 +7031,17 @@ export interface components {
* Avatar Template
* @description The avatar template of the user.
*/
avatar_template: string;
avatar_template: string | null;
/**
* Blurb
* @description The blurb of the post.
*/
blurb: string;
blurb: string | null;
/**
* Created At
* @description The creation date of the post.
*/
created_at: string;
created_at: string | null;
/**
* Id
* @description The ID of the post.
Expand All @@ -7051,27 +7051,27 @@ export interface components {
* Like Count
* @description The number of likes of the post.
*/
like_count: number;
like_count: number | null;
/**
* Name
* @description The name of the post.
*/
name: string;
name: string | null;
/**
* Post Number
* @description The post number of the post.
*/
post_number: number;
post_number: number | null;
/**
* Topic Id
* @description The ID of the topic of the post.
*/
topic_id: number;
topic_id: number | null;
/**
* Username
* @description The username of the post author.
*/
username: string;
username: string | null;
[key: string]: unknown | undefined;
};
/**
Expand Down
16 changes: 8 additions & 8 deletions lib/galaxy/schema/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ class HelpForumPost(HelpTempBaseModel):
"""Model for a post in the help forum."""

id: Annotated[int, Field(description="The ID of the post.")]
name: Annotated[str, Field(description="The name of the post.")]
username: Annotated[str, Field(description="The username of the post author.")]
avatar_template: Annotated[str, Field(description="The avatar template of the user.")]
created_at: Annotated[str, Field(description="The creation date of the post.")]
like_count: Annotated[int, Field(description="The number of likes of the post.")]
blurb: Annotated[str, Field(description="The blurb of the post.")]
post_number: Annotated[int, Field(description="The post number of the post.")]
topic_id: Annotated[int, Field(description="The ID of the topic of the post.")]
name: Annotated[Optional[str], Field(description="The name of the post.")]
username: Annotated[Optional[str], Field(description="The username of the post author.")]
avatar_template: Annotated[Optional[str], Field(description="The avatar template of the user.")]
created_at: Annotated[Optional[str], Field(description="The creation date of the post.")]
like_count: Annotated[Optional[int], Field(description="The number of likes of the post.")]
blurb: Annotated[Optional[str], Field(description="The blurb of the post.")]
post_number: Annotated[Optional[int], Field(description="The post number of the post.")]
topic_id: Annotated[Optional[int], Field(description="The ID of the topic of the post.")]


class HelpForumTopic(Model):
Expand Down

0 comments on commit 52f3445

Please sign in to comment.