Skip to content

Conversation

@Kosinkadink
Copy link
Collaborator

@Kosinkadink Kosinkadink commented Nov 5, 2025

(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 Kosinkadink marked this pull request as ready for review November 12, 2025 18:56
christian-byrne pushed a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request Nov 12, 2025
This PR implements front end logic to handle MatchType inputs and
outputs.
See  comfyanonymous/ComfyUI#10644

This allows for the implementation of nodes such as a "switch node"
where input types change based on the connections made.

![switch-node](https://github.com/user-attachments/assets/090515ba-484c-4295-b7b3-204b0c72fc4a)

As part of this implementation, significant cleanup is being performed
in the reroute code. Extra testing will be required to make sure these
changes don't introduce regressions.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6582-Add-front-end-support-for-type-matching-2a16d73d36508189b042cd23f82a332e)
by [Unito](https://www.unito.io)
@Kosinkadink Kosinkadink added the Core Core team dependency label Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Core Core team dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants