Fix components value handling in InputValueRequest
This commit is contained in:
parent
3628944782
commit
c80ee236c9
2 changed files with 5 additions and 3 deletions
|
|
@ -259,7 +259,7 @@ class VerticesBuiltResponse(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
class InputValueRequest(BaseModel):
|
class InputValueRequest(BaseModel):
|
||||||
components: Optional[List[str]] = None
|
components: Optional[List[str]] = []
|
||||||
input_value: Optional[str] = None
|
input_value: Optional[str] = None
|
||||||
|
|
||||||
# add an example
|
# add an example
|
||||||
|
|
|
||||||
|
|
@ -202,8 +202,10 @@ class Graph:
|
||||||
for input_dict in inputs:
|
for input_dict in inputs:
|
||||||
components: Union[str, list[str]] = input_dict.get("components", [])
|
components: Union[str, list[str]] = input_dict.get("components", [])
|
||||||
|
|
||||||
if not isinstance(components, list):
|
if components and not isinstance(components, list):
|
||||||
components = [components]
|
raise ValueError(f"Invalid components value: {components}. Expected list")
|
||||||
|
elif components is None:
|
||||||
|
components = []
|
||||||
|
|
||||||
if INPUT_FIELD_NAME not in input_dict:
|
if INPUT_FIELD_NAME not in input_dict:
|
||||||
input_value = ""
|
input_value = ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue