feat: pydantic descriptors
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from .form_base_descriptor_models import FormDescriptor, RowElement, AreaElement, LinkPort
|
||||
|
||||
|
||||
class SwitchNodeData(BaseModel):
|
||||
@@ -35,3 +36,30 @@ class SwitchNodeCoreSchema(BaseModel):
|
||||
parent_id: Optional[int] = Field(default=None, description="ID родительского узла")
|
||||
parent_port_number: Optional[int] = Field(default=None, description="Номер порта родительского узла")
|
||||
data: Optional[SwitchNodeCoreSchemaData] = Field(default=None, description="Данные узла")
|
||||
|
||||
|
||||
# Дескриптор формы узла SWITCH
|
||||
SWITCH_FORM_DESCRIPTOR = FormDescriptor(
|
||||
elements=[
|
||||
RowElement(
|
||||
name="switch_row",
|
||||
type="row",
|
||||
label="Switch condition",
|
||||
link_port=LinkPort(id="case_1_output", label="case_1", is_addable=True),
|
||||
elements=[
|
||||
AreaElement(
|
||||
name="switch_value",
|
||||
type="area",
|
||||
label="Switch condition",
|
||||
placeholder="Enter condition",
|
||||
)
|
||||
],
|
||||
),
|
||||
RowElement(
|
||||
name="default_row",
|
||||
type="row",
|
||||
label="Default",
|
||||
link_port=LinkPort(id="default_output", label="default"),
|
||||
),
|
||||
]
|
||||
)
|
||||
|
Reference in New Issue
Block a user