Skip to content

Conversation

bigcat88
Copy link
Contributor

@bigcat88 bigcat88 commented Oct 6, 2025

This PR adds a tiny normalization step so Combo.Input can take a Python Enum class directly as options. We expand the enum to its member .value list at construction time, which:

  • eliminates repetitive [m.value for m in MyEnum] boilerplate
  • ensures options stay in sync with the enum definition

The change is backward‑compatible (existing list[str] still works) and requires no frontend adjustments. Default handling remains unchanged.

Also extended typing for options and default as they can receive ints and not only str which many API nodes passes to them.

Example of the simplification(in API nodes there is around 30 such usages):

comfy_io.Combo.Input(
    "model",
    options=Text2ImageModelName,  # old code: options=[model.value for model in Text2ImageModelName],  
    default=Text2ImageModelName.seedream_3,
    tooltip="Model name",
),

@bigcat88 bigcat88 requested a review from Kosinkadink as a code owner October 6, 2025 16:55
@Kosinkadink
Copy link
Collaborator

The only change required here would be to make sure that default gets cast to the value if it is an Enum

@Kosinkadink Kosinkadink added the v3 label Oct 6, 2025
@bigcat88 bigcat88 force-pushed the v3/combo-input-allow-enum branch from 26f2b4a to 05e12a0 Compare October 7, 2025 05:34
@bigcat88
Copy link
Contributor Author

bigcat88 commented Oct 7, 2025

The only change required here would be to make sure that default gets cast to the value if it is an Enum

done 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants