From 68153f6c047ac7554ebf0995c8a80db06a1f2116 Mon Sep 17 00:00:00 2001 From: Kosinkadink Date: Sat, 15 Nov 2025 21:59:28 -0800 Subject: [PATCH] Support validation of inputs and outputs --- comfy_api/latest/_io.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/comfy_api/latest/_io.py b/comfy_api/latest/_io.py index ffc80c947..d74fe2cf0 100644 --- a/comfy_api/latest/_io.py +++ b/comfy_api/latest/_io.py @@ -150,6 +150,9 @@ class _IO_V3: def __init__(self): pass + def validate(self): + pass + @property def io_type(self): return self.Parent.io_type @@ -898,6 +901,12 @@ class DynamicCombo(ComfyTypeI): return super().as_dict() | prune_dict({ "options": [o.as_dict() for o in self.options], }) + + def validate(self): + # make sure all nested inputs are validated + for option in self.options: + for input in option.inputs: + input.validate() @comfytype(io_type="COMFY_MATCHTYPE_V3") class MatchType(ComfyTypeIO): @@ -1105,6 +1114,11 @@ class Schema: issues.append(f"Ids must be unique between inputs and outputs, but {intersection} are not.") if len(issues) > 0: raise ValueError("\n".join(issues)) + # validate inputs and outputs + for input in self.inputs: + input.validate() + for output in self.outputs: + output.validate() def finalize(self): """Add hidden based on selected schema options, and give outputs without ids default ids.""" @@ -1697,6 +1711,7 @@ __all__ = [ "MultiType", # Dynamic Types "MatchType", + "DynamicCombo", # Other classes "HiddenHolder", "Hidden",