diff --git a/src/api/src/backend/views/http/requests.py b/src/api/src/backend/views/http/requests.py index d15c94c5..052e16c4 100644 --- a/src/api/src/backend/views/http/requests.py +++ b/src/api/src/backend/views/http/requests.py @@ -635,9 +635,16 @@ class FunctionTask(BaseTask): runtime: EnumRuntimeEnvironment packages: List[str] = [] installer: EnumInstaller - code: str + code: str = None + entrypoint: str = None command: str = None + @root_validator(pre=True) + def code_or_entrypoint(cls, values): + if values.get("code", None) == None and values.get("entrypoint", None) == None: + raise ValueError("Function tasks must define at least one of the following: [code, entrypoint] | Neither were defined") + + return values # Pipelines Task = Annotated[ @@ -696,6 +703,7 @@ def backwards_compatibility_transforms(cls, values): } return values + class Config: extra = Extra.allow diff --git a/src/engine/src/owe_python_sdk/schema.py b/src/engine/src/owe_python_sdk/schema.py index d15c94c5..052e16c4 100644 --- a/src/engine/src/owe_python_sdk/schema.py +++ b/src/engine/src/owe_python_sdk/schema.py @@ -635,9 +635,16 @@ class FunctionTask(BaseTask): runtime: EnumRuntimeEnvironment packages: List[str] = [] installer: EnumInstaller - code: str + code: str = None + entrypoint: str = None command: str = None + @root_validator(pre=True) + def code_or_entrypoint(cls, values): + if values.get("code", None) == None and values.get("entrypoint", None) == None: + raise ValueError("Function tasks must define at least one of the following: [code, entrypoint] | Neither were defined") + + return values # Pipelines Task = Annotated[ @@ -696,6 +703,7 @@ def backwards_compatibility_transforms(cls, values): } return values + class Config: extra = Extra.allow