ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Add MatchType to V3 Schema - provides native Switch node support

Open Kosinkadink opened this issue 1 week ago • 0 comments
trafficstars

(Waiting for frontend PR to be merged first)

This PR adds the first native dynamic type: MatchType.

You can now force inputs and outputs to 'match' types while being able to specify what subset of types should be allowed, if desired.


from comfy_api.latest import io

...

    @classmethod
    def define_schema(cls):
        templateA = io.MatchType.Template("groupA")
        return io.Schema(
            node_id="ComfySwitchNode",
            display_name="Switch",
            category="logic",
            inputs=[
                io.MatchType.Input("input1", template=templateA),
                io.MatchType.Input("input2", template=templateA),
            ],
            outputs=[
                io.MatchType.Output("output", template=templateA, display_name="output"),
            ],
        )

templateA = io.MatchType.Template("groupA")
templateB = io.MatchType.Template("groupB",  allowed_types=[io.Int, io.Float, io.Mask, io.Image])

I already wrote a lot of the schema over the summer, this PR adds some final elements to expose it properly for frontend development.

Kosinkadink avatar Nov 05 '25 05:11 Kosinkadink