diff --git a/hvcc/core/json/heavy_ir.py b/hvcc/core/json/heavy_ir.py index 1680f78..dd4850a 100644 --- a/hvcc/core/json/heavy_ir.py +++ b/hvcc/core/json/heavy_ir.py @@ -1,5 +1,8 @@ from pydantic import BaseModel, RootModel -from typing import List, Optional, Union +from typing import List, Optional, Union, Literal + + +ConnectionType = Literal["-->", "~i>", "~f>", "signal"] class Arg(BaseModel): @@ -23,9 +26,9 @@ class Perf(BaseModel): class IRNode(BaseModel): - inlets: List[str] + inlets: List[ConnectionType] ir: IR - outlets: List[str] + outlets: List[ConnectionType] args: List[Arg] = [] perf: Optional[Perf] = Perf() # perf: Perf diff --git a/hvcc/core/json/heavy_lang.py b/hvcc/core/json/heavy_lang.py index f378fb2..b126f1f 100644 --- a/hvcc/core/json/heavy_lang.py +++ b/hvcc/core/json/heavy_lang.py @@ -1,25 +1,28 @@ from pydantic import BaseModel, RootModel -from typing import List, Optional, Any +from typing import List, Optional, Dict, Literal, Union -class Inlet(BaseModel): +ConnectionType = Literal["-->", "-~>", "~f>"] + + +class Arg(BaseModel): name: str - connectionType: str + value_type: Optional[str] description: str + default: Union[float, int, str, Dict, List, None] = None + required: bool -class Outlet(BaseModel): +class Inlet(BaseModel): name: str - connectionType: str + connectionType: ConnectionType description: str -class Arg(BaseModel): +class Outlet(BaseModel): name: str - value_type: Optional[str] + connectionType: ConnectionType description: str - default: Any - required: bool class LangNode(BaseModel):