Skip to content

Commit fa3064f

Browse files
authored
Update models.py
1 parent 89ac664 commit fa3064f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/python_workflow_definition/models.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
from pathlib import Path
2-
from typing import List, Union, Optional, Literal, Any, Annotated, Type, TypeVar
2+
from typing import (
3+
List,
4+
Union,
5+
Optional,
6+
Literal,
7+
Any,
8+
Annotated,
9+
Type,
10+
TypeVar,
11+
)
12+
from typing_extensions import TypeAliasType
313
from pydantic import BaseModel, Field, field_validator, field_serializer
414
from pydantic import ValidationError
515
import json
@@ -20,7 +30,9 @@
2030

2131

2232
JsonPrimitive = Union[str, int, float, bool, None]
23-
JsonValue = Union[JsonPrimitive, list[JsonPrimitive], dict[str, JsonPrimitive]]
33+
AllowableDefaults = TypeAliasType(
34+
"AllowableDefaults", "Union[JsonPrimitive, dict[str, AllowableDefaults], tuple[AllowableDefaults, ...]]"
35+
)
2436

2537

2638
class PythonWorkflowDefinitionBaseNode(BaseModel):
@@ -37,7 +49,7 @@ class PythonWorkflowDefinitionInputNode(PythonWorkflowDefinitionBaseNode):
3749

3850
type: Literal["input"]
3951
name: str
40-
value: Optional[JsonValue] = None
52+
value: Optional[AllowableDefaults] = None
4153

4254

4355
class PythonWorkflowDefinitionOutputNode(PythonWorkflowDefinitionBaseNode):

0 commit comments

Comments
 (0)