Skip to content

Commit

Permalink
Merge pull request #17296 from ElectronicBlueberry/workflow_comments_…
Browse files Browse the repository at this point in the history
…pydantic2_fix

Fix Workflow Comment Model for Pydantic 2
  • Loading branch information
mvdbeek authored Jan 15, 2024
2 parents f7018e4 + dc2132d commit 122b19a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/galaxy/schema/workflow/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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"
)


Expand All @@ -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")

0 comments on commit 122b19a

Please sign in to comment.