diff --git a/src/backend/base/langflow/custom/custom_component/component.py b/src/backend/base/langflow/custom/custom_component/component.py index ac5b46a30..29b9e9020 100644 --- a/src/backend/base/langflow/custom/custom_component/component.py +++ b/src/backend/base/langflow/custom/custom_component/component.py @@ -11,7 +11,6 @@ from langflow.inputs.inputs import InputTypes from langflow.schema.artifact import get_artifact_type, post_process_raw from langflow.schema.data import Data from langflow.template.field.base import UNDEFINED, Input, Output -from langflow.utils.util import is_class_method from .custom_component import CustomComponent @@ -63,9 +62,8 @@ class Component(CustomComponent): if key not in self._inputs: raise ValueError(f"Input {key} not found in arguments") input_ = self._inputs[key] - # validate_inputs must be a classmethod - if hasattr(input_, "validate_value") and is_class_method(func=input_.validate_value, cls=input_): - input_.validate_value(value) + # BaseInputMixin has a `validate_assignment=True` + input_.value = value def set_attributes(self, params: dict): self._validate_inputs(params) diff --git a/src/backend/base/langflow/inputs/input_mixin.py b/src/backend/base/langflow/inputs/input_mixin.py index 07e4f6338..97310e537 100644 --- a/src/backend/base/langflow/inputs/input_mixin.py +++ b/src/backend/base/langflow/inputs/input_mixin.py @@ -22,7 +22,7 @@ SerializableFieldTypes = Annotated[FieldTypes, PlainSerializer(lambda v: v.value # Base mixin for common input field attributes and methods -class BaseInputMixin(BaseModel): +class BaseInputMixin(BaseModel, validate_assignment=True): model_config = ConfigDict(arbitrary_types_allowed=True) field_type: Optional[SerializableFieldTypes | str] = Field(default=FieldTypes.TEXT)