Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Change validate_inputs' output typehint to 'bool | str' and update docstrings (#9786)

Jedrzej Kosinski206595f854c6
diff --git a/comfy_api/latest/_io.py b/comfy_api/latest/_io.py
index e0ee943a7..f770109d5 100644
--- a/comfy_api/latest/_io.py
+++ b/comfy_api/latest/_io.py
@@ -1190,13 +1190,18 @@ class _ComfyNodeBaseInternal(_ComfyNodeInternal):
raise NotImplementedError
@classmethod
- def validate_inputs(cls, **kwargs) -> bool:
- """Optionally, define this function to validate inputs; equivalent to V1's VALIDATE_INPUTS."""
+ def validate_inputs(cls, **kwargs) -> bool | str:
+ """Optionally, define this function to validate inputs; equivalent to V1's VALIDATE_INPUTS.
+
+ If the function returns a string, it will be used as the validation error message for the node.
+ """
raise NotImplementedError
@classmethod
def fingerprint_inputs(cls, **kwargs) -> Any:
- """Optionally, define this function to fingerprint inputs; equivalent to V1's IS_CHANGED."""
+ """Optionally, define this function to fingerprint inputs; equivalent to V1's IS_CHANGED.
+
+ If this function returns the same value as last run, the node will not be executed."""
raise NotImplementedError
@classmethod