No description
  • Python 97.3%
  • Just 2.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-03-11 23:26:13 -04:00
fw_nodes_test Created a test node with all input type options to test the node settings panel 2026-03-11 01:12:41 -04:00
tests Created a test node with all input type options to test the node settings panel 2026-03-11 01:12:41 -04:00
.gitignore Created a test node with all input type options to test the node settings panel 2026-03-11 01:12:41 -04:00
justfile Created a test node with all input type options to test the node settings panel 2026-03-11 01:12:41 -04:00
pyproject.toml Created a test node with all input type options to test the node settings panel 2026-03-11 01:12:41 -04:00
README.md Update README.md to include comprehensive node input type reference and usage details 2026-03-11 23:26:13 -04:00

fw-nodes-test

Test nodes for Flowire UI testing. Not for production use.

The Field Showcase node (field_showcase.py) exercises field types for UI testing. This README documents every supported input type and variation across the entire platform.


Complete Node Input Type Reference

This is the authoritative list of every input type and variation supported by the Flowire node system. Types are defined via Pydantic v2 models in Python and rendered by NodePropertyEditor in the frontend.

How It Works

  1. Python side: Node authors define input_schema as a Pydantic BaseModel
  2. Backend: model_json_schema() converts it to JSON Schema
  3. Frontend: NodePropertyEditor.tsx reads the JSON Schema and renders the appropriate UI widget
  4. Validation: Both Pydantic (backend) and nodeValidation.ts (frontend) enforce constraints

Base Types

1. String (str)

UI Widget: ExpressionInput (single-line text with pill editor for expressions)

Variation Python Definition Frontend Behavior
Required field: str = Field(...) Shows * indicator, error badge when empty
Optional field: str | None = Field(default=None) No *, accepts empty/cleared
With default field: str = Field(default="hello") Pre-fills on node creation, no *
Min length field: str = Field(..., min_length=3) Inline error: "Must be at least 3 characters"
Max length field: str = Field(default="", max_length=10) Inline error: "Must be at most 10 characters"
Min + max length field: str = Field(default="", min_length=2, max_length=5) Both length validations
Pattern (regex) field: str = Field(..., pattern=r'^[a-z]+$') Passed to JSON Schema (backend-validated)

All string fields support expression mode toggle: user can switch between typing text and entering {{node-id.field}} expressions.

2. Textarea / Multiline String

UI Widget: ExpressionInput with multiline=true (taller, multi-row text area)

field: str = Field(default="", json_schema_extra={"format": "textarea"})

Same constraints as regular string (min_length, max_length, etc.) but renders as a multiline editor.

3. Integer (int)

UI Widget: <input type="number"> with step="1"

Variation Python Definition Frontend Behavior
Required field: int = Field(...) Shows *, error when empty
With default field: int = Field(default=1) Pre-fills, no *
Min (inclusive) field: int = Field(..., ge=0) Error: "Must be >= 0"
Max (inclusive) field: int = Field(..., le=100) Error: "Must be <= 100"
Min (exclusive) field: int = Field(..., gt=0) Error: "Must be > 0"
Max (exclusive) field: int = Field(..., lt=65536) Error: "Must be < 65536"
Range field: int = Field(default=50, ge=0, le=100) Both bounds enforced

Typing a decimal (e.g., 1.5) shows "Must be a whole number" error. Supports expression mode toggle.

4. Float (float)

UI Widget: <input type="number"> with step="any" (or custom step)

Variation Python Definition Frontend Behavior
Required field: float = Field(...) Shows *, error when empty
With bounds field: float = Field(default=0.7, ge=0.0, le=2.0) Range validation
Custom step field: float = Field(..., ge=0.0, json_schema_extra={"step": 0.1}) Arrow keys increment by 0.1

Supports all the same ge, le, gt, lt constraints as integers. Supports expression mode toggle.

5. Boolean (bool)

UI Widget: <Checkbox> component, shows "Yes"/"No" label

field: bool = Field(default=True)   # Checked by default
field: bool = Field(default=False)  # Unchecked by default

Supports expression mode toggle (switch to entering {{...}} expression).


Enum / Dropdown Types

6. StrEnum Dropdown

UI Widget: <select> dropdown

from enum import StrEnum

class HTTPMethod(StrEnum):
    GET = "GET"
    POST = "POST"
    PUT = "PUT"

field: HTTPMethod = Field(default=HTTPMethod.GET)  # Pre-selects "GET"
field: HTTPMethod = Field(...)                      # Shows "Select..." placeholder, required
Variation Behavior
With default Pre-selects value, no placeholder
Required (no default) Shows "Select..." placeholder, * indicator, error if unselected
Expression toggle Can switch to expression mode for dynamic values

7. Literal Dropdown

UI Widget: <select> dropdown (same as StrEnum, converted to enum in JSON Schema)

from typing import Literal

field: Literal["inline", "distributed"] = Field(default="inline")
field: Literal["open", "closed", "all"] = Field(default="open")

Behaves identically to StrEnum. Commonly used for simple string choices without defining a separate enum class.

8. Optional Literal

field: Literal["open", "closed"] | None = Field(default=None)

Dropdown with an empty/none option.


Dynamic Options (API-Fetched Dropdowns)

9. Dynamic Single-Select

UI Widget: DynamicOptionsField (combobox with search, loading state, refresh button)

field: str = Field(
    ...,
    description="Channel to post to",
    json_schema_extra={"x-dynamic-options": {"depends_on": ["credential_id"]}},
)

How it works:

  1. Frontend sees x-dynamic-options and renders DynamicOptionsField
  2. When depends_on fields are filled, it calls GET /nodes/{type}/fields/{field}/options
  3. Backend calls node.get_field_options(field_name, credential_data) which returns list[FieldOption]
  4. Each FieldOption has id (stored value), name (display), optional description (tooltip)
  5. Results cached in Redis (1-hour TTL), refresh button available
  6. If dependencies are unfilled, shows hint instead of dropdown

Supports expression mode toggle. Supports custom typed values.

Used by: Mattermost (channels, teams), Slack (channels), Supabase (tables), Home Assistant (entities), AI (models)

10. Dynamic Multi-Select

UI Widget: DynamicMultiOptionsField (multi-select combobox)

field: list[str] = Field(
    default=None,
    json_schema_extra={"x-dynamic-options": {"depends_on": ["credential_id"]}},
)

Same as single-select but allows multiple selections. Used for array fields with x-dynamic-options.

Used by: Slack stream trigger (channels), Home Assistant stream trigger (entities)


Object / Dictionary Types

11. Dictionary (dict)

UI Widget: ObjectKeyValueEditor (key-value pair rows) with toggle to JSON code editor

Variation Python Definition Value Behavior
String values dict[str, str] Values stored as strings, no JSON coercion
Integer values dict[str, int] Values validated as integers in form mode
Any values dict[str, Any] Values auto-parsed as JSON, fallback to string
Optional dict[str, str] | None = Field(default=None) Can be empty/null
Required with default dict[str, Any] = Field(default_factory=dict) Starts as {}

Two modes:

  • Form mode (default): Key-value pair rows with add/remove buttons
  • Code mode: Raw JSON editor via ExpressionInput (multiline)

Auto-switches to code mode if:

  • Value contains {{...}} expressions
  • JSON is malformed/unparseable

Array / List Types

12. List of Strings (list[str])

UI Widget: ArrayItemsEditor (tag-style input with chips, one item per row)

field: list[str] = Field(default_factory=list)

Supports expression toggle to switch to JSON code editor mode.

13. List of Integers (list[int])

UI Widget: ArrayItemsEditor with per-entry integer validation

field: list[int] = Field(default_factory=list)

Validates each entry is a whole number. Rejects decimals and non-numeric input.

14. List of Any (list[Any])

UI Widget: ArrayItemsEditor or JSON code editor

field: list[Any] = Field(...)                                    # Required
field: list[Any] = Field(default_factory=list)                   # Optional with default
field: list[Any] = Field(..., min_length=1)                      # Non-empty required
Variation Behavior
Required Shows *, error badge when empty
min_length Validates minimum number of items

15. List of Objects (list[Model])

UI Widget: KeyValueEditor (structured rows matching model fields)

class TagPair(BaseModel):
    key: str = Field(..., description="Tag name", min_length=1)
    value: Any = Field(..., description="Tag value")

field: list[TagPair] = Field(default_factory=list)

Renders as structured rows with labeled columns matching the nested model's fields. Has add/remove row buttons. Detects duplicate keys. Supports toggle to JSON code editor mode.

16. List of Dicts (list[dict[str, Any]])

UI Widget: JSON code editor (treated as complex array)

field: list[dict[str, Any]] = Field(default_factory=list)

Special Types

17. Any Type

UI Widget: ExpressionInput with multiline=true

field: Any = Field(default=None)
field: Any = Field(...)  # Required

Accepts strings, numbers, objects, arrays. Attempts JSON parse on save, falls back to raw string.

18. Color Picker

UI Widget: ColorPicker component (triggered by field name heuristic)

background_color: str = Field(default="#3b82f6")

Detection: Any field whose key contains "color" (case-insensitive) renders as a color picker. No json_schema_extra needed. Supports expression mode toggle.

Exception: Skipped when display_component is "comment" or "group".

19. Credential Selector

UI Widget: CredentialSelector dropdown (filtered by credential type + workflow access)

# In input schema:
credential_id: str = Field(..., description="Authentication credential")

# On the node class:
credential_schema = MyCredentialSchema

Detection: Field named credential_id on a node that has credential_type defined. Fetches available credentials for the project. Supports expression mode toggle.

20. Hidden Field

UI Widget: None (not rendered in the settings panel)

field: str = Field(default="internal", json_schema_extra={"x-hidden": True})

Used for internal state that shouldn't be user-editable.


Code Editor

21. Code Editor Field

UI Widget: Modal with Monaco code editor, language/runtime dropdowns

Activated via CodeEditorContract on node metadata:

from flowire_sdk import CodeEditorContract, NodeMetadata

metadata = NodeMetadata(
    name="Code",
    display_component="code",
    code_editor=CodeEditorContract(
        code_field="code",                          # Input field containing user code
        language_field="language",                   # Input field for language selection
        runtime_field="runtime",                     # Optional: runtime version field
        code_format="code",                          # JSON schema format marker
        language_defaults={"python": "result = {}"}, # Default code templates per language
        language_options=["python", "javascript"],   # Available languages
        runtime_options={"python": ["3.11", "3.12"]},# Optional: runtimes per language
    ),
)

Related input schema fields:

# Code field — marked with format="code"
code: str = Field(default="...", json_schema_extra={"format": "code"})

# Language field — enum or has x-code-defaults
language: Language = Field(
    default=Language.JAVASCRIPT,
    json_schema_extra={"x-code-defaults": {"javascript": JS_CODE, "python": PY_CODE}},
)

# Optional runtime field
runtime: str = Field(default="20")

Frontend behavior:

  • Code field renders as a button that opens a modal with full Monaco editor
  • Language dropdown in the code editor header (auto-applies code template on change)
  • Runtime dropdown if runtime_field is defined
  • Can also be triggered by json_schema_extra={"format": "code"} alone (backward compat)

Credential Schema Fields

Credential schemas define the fields shown when users create/edit credentials. These use a separate rendering path (CredentialField.tsx) but still use Pydantic models.

Type Widget
str Text input (or password input if field name contains 'secret', 'key', 'token', 'password')
bool Switch toggle
Enum/Literal Select dropdown

Node Metadata Display Components

The display_component field on NodeMetadata controls how the entire node renders on the canvas:

Value Behavior
None (default) Standard node with input handles, output handles, icon, label
"code" Code editor node — shows code preview, opens modal on click
"comment" Sticky note / comment — visual-only, not executed, skip_execution=True
"group" Grouping container — visual-only, not executed, skip_execution=True

Cross-Cutting Features

Expression Support

All text-accepting fields support {{...}} expressions:

  • {{node-id.field}} — reference another node's output
  • {{project.uuid}} — reference a project variable
  • {{_meta.execution_id}} — execution metadata
  • {{coalesce(source1, source2, "default")}} — first non-null value
  • Nested paths: {{NodeA.data.users.0.name}}

Expression mode toggle: Non-text fields (number, boolean, enum, credential, color, dynamic options) can switch between their native widget and a text input for entering expressions.

Required vs Optional

Pattern Required? UI Indicator
field: str = Field(...) Yes Shows *
field: str = Field(default="x") No No *
field: str | None = Field(default=None) No No *
field: list[Any] = Field(...) Yes Shows *, error when empty
field: list[str] = Field(default_factory=list) No No *

Form/Code Mode Toggle (Objects & Arrays)

Object and array fields can toggle between:

  • Form mode: Structured editors (key-value pairs, tag chips, etc.)
  • Code mode: Raw JSON editor via ExpressionInput

Auto-switches to code mode when:

  • Value contains {{...}} expressions (expressions not supported in form mode)
  • JSON is malformed/unparseable

Info Popover

Every field shows an info icon (i) that displays:

  • Type name (e.g., "Text", "Whole number", "List of text pairs")
  • Default value (if any)
  • Enum options (if applicable)
  • Required status
  • Constraints (min/max, minLength/maxLength)

Summary: json_schema_extra Keys

Key Purpose Example
format: "textarea" Multiline text input json_schema_extra={"format": "textarea"}
format: "code" Code editor field json_schema_extra={"format": "code"}
x-hidden: True Hide field from UI json_schema_extra={"x-hidden": True}
x-dynamic-options API-fetched dropdown json_schema_extra={"x-dynamic-options": {"depends_on": ["credential_id"]}}
x-code-defaults Code templates per language json_schema_extra={"x-code-defaults": {"python": "..."}}
step Numeric input step increment json_schema_extra={"step": 0.1}

Summary: Pydantic Field() Constraints

Constraint Applies To JSON Schema Key Frontend Validation
min_length str, list minLength "Must be at least N characters" / min items
max_length str maxLength "Must be at most N characters"
ge int, float minimum "Must be >= N"
le int, float maximum "Must be <= N"
gt int, float exclusiveMinimum "Must be > N"
lt int, float exclusiveMaximum "Must be < N"
pattern str pattern Backend-validated only

What the Field Showcase Covers vs. Doesn't

Covered by Field Showcase

  • Required string, optional string, string with default
  • String with min_length, max_length, both
  • Textarea (multiline)
  • Color picker (name-based detection)
  • StrEnum dropdown (with and without default)
  • Integer (with default, required, ge/le, gt/lt)
  • Float (with bounds, custom step, required)
  • Boolean (true/false defaults)
  • Dict with string values, any values, integer values, optional
  • List of strings, integers, any
  • List of objects (KeyValueEditor)
  • Any type
  • Hidden field (x-hidden)

NOT Covered (exists in real nodes but missing from Field Showcase)

  • Literal type dropdown — Literal["a", "b", "c"] (used in for_each, webhook, load_value, etc.)
  • Optional Literal — Literal["open", "closed"] | None (used in GitHub/Forgejo nodes)
  • Dynamic single-select — str with x-dynamic-options (used in Mattermost, Slack, Supabase, etc.)
  • Dynamic multi-select — list[str] with x-dynamic-options (used in stream triggers)
  • Code editor field — str with format: "code" + CodeEditorContract (used in Code, Postgres nodes)
  • Credential selector — credential_id: str with credential_schema on node class
  • String with pattern — str with pattern=r'...' regex constraint
  • List with min_length — list[Any] = Field(..., min_length=1) for non-empty validation
  • Complex union — str | list[str] (used in webscraping nodes)
  • List of dicts — list[dict[str, Any]] (used in error outputs)
  • Nested model with Literal — Object items containing Literal fields (e.g., FilterConfig in Supabase)