From dc2132d305af80a5688b76ce5c0088affe14a747 Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:12:25 +0100 Subject: [PATCH] fix model for pydantic 2 --- lib/galaxy/schema/workflow/comments.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/schema/workflow/comments.py b/lib/galaxy/schema/workflow/comments.py index 6396d39ab33b..488df52d68c2 100644 --- a/lib/galaxy/schema/workflow/comments.py +++ b/lib/galaxy/schema/workflow/comments.py @@ -23,8 +23,12 @@ class BaseComment(BaseModel): class TextCommentData(BaseModel): - bold: Optional[bool] = Field(description="If the Comments text is bold. Absent is interpreted as false") - italic: Optional[bool] = Field(description="If the Comments text is italic. Absent is interpreted as false") + bold: Optional[bool] = Field( + default=None, description="If the Comments text is bold. Absent is interpreted as false" + ) + italic: Optional[bool] = Field( + default=None, description="If the Comments text is italic. Absent is interpreted as false" + ) size: int = Field(..., description="Relative size (1 -> 100%) of the text compared to the default text sitz") text: str = Field(..., description="The plaintext text of this comment") @@ -51,10 +55,10 @@ class FrameComment(BaseComment): type: Literal["frame"] data: FrameCommentData child_comments: Optional[List[int]] = Field( - description="A list of ids (see `id`) of all Comments which are encompassed by this Frame" + default=None, description="A list of ids (see `id`) of all Comments which are encompassed by this Frame" ) child_steps: Optional[List[int]] = Field( - description="A list of ids of all Steps (see WorkflowStep.id) which are encompassed by this Frame" + default=None, description="A list of ids of all Steps (see WorkflowStep.id) which are encompassed by this Frame" ) @@ -72,4 +76,4 @@ class FreehandComment(BaseComment): class WorkflowCommentModel(RootModel): - root: Union[TextComment, MarkdownComment, FrameComment, FreehandComment] + root: Union[TextComment, MarkdownComment, FrameComment, FreehandComment] = Field(..., discriminator="type")