Skip to content

Commit

Permalink
Add deprecated field to action models
Browse files Browse the repository at this point in the history
  • Loading branch information
topher-lo committed Jan 15, 2025
1 parent 3a3e609 commit 8d36f53
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tracecat/registry/actions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class BoundRegistryAction(BaseModel):
display_group: str | None
doc_url: str | None
author: str | None
deprecated: str | None
# Options
include_in_schema: bool = True

Expand Down Expand Up @@ -174,6 +175,10 @@ class TemplateActionDefinition(BaseModel):
display_group: str = Field(..., description="The display group of the action")
doc_url: str | None = Field(default=None, description="Link to documentation")
author: str | None = Field(default=None, description="Author of the action")
deprecated: str | None = Field(
default=None,
description="Marks action as deprecated along with message",
)
secrets: list[RegistrySecret] | None = Field(
default=None, description="The secrets to pass to the action"
)
Expand Down Expand Up @@ -274,6 +279,12 @@ class RegistryActionBase(BaseModel):
min_length=1,
max_length=100,
)
deprecated: str | None = Field(
None,
description="Marks action as deprecated along with message",
min_length=1,
max_length=1000,
)
options: RegistryActionOptions = Field(
default_factory=lambda: RegistryActionOptions(),
description="The options for the action",
Expand Down Expand Up @@ -312,6 +323,7 @@ def from_database(
type=cast(RegistryActionType, action.type),
doc_url=action.doc_url,
author=action.author,
deprecated=action.deprecated,
interface=model_converters.db_to_interface(action),
implementation=impl,
default_title=action.default_title,
Expand Down Expand Up @@ -341,6 +353,7 @@ def from_bound(
display_group=action.display_group,
doc_url=action.doc_url,
author=action.author,
deprecated=action.deprecated,
origin=action.origin,
secrets=action.secrets,
options=RegistryActionOptions(include_in_schema=action.include_in_schema),
Expand Down Expand Up @@ -412,6 +425,7 @@ def from_bound(action: BoundRegistryAction) -> RegistryActionUpdate:
default_title=action.default_title,
display_group=action.display_group,
doc_url=action.doc_url,
author=action.author,
options=RegistryActionOptions(include_in_schema=action.include_in_schema),
)

Expand Down

0 comments on commit 8d36f53

Please sign in to comment.