Skip to content

Conversation

@sberan
Copy link
Contributor

@sberan sberan commented Jan 9, 2026

Description

When linking workflow input parameters to Motion Detection block properties (Minimum Contour Area, Morphological Kernel Size, Threshold, History), Pydantic would throw:

TypeError: Unable to apply constraint 'gt' to supplied value $inputs.min_contour_area

This happened because gt=0 was applied at the Field level, which affects all types in the Union including the Selector string.

Solution:

Use PositiveInt (a Pydantic type with built-in > 0 constraint) as the first type in the Union instead of int with gt=0 on the Field. This ensures the constraint only applies when an actual integer is provided, not when a selector string is passed.

This follows the pattern used by other blocks like Image Slicer.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this change been tested, please provide a testcase or example of how you tested the change?

tested via unit tests

Any specific deployment considerations

standard deploy

Docs

  • n/a, is bugfix

@sberan sberan force-pushed the motion-detection-input-parameter branch from 8eb4cde to 4dba085 Compare January 9, 2026 15:34
@sberan sberan merged commit f48c631 into main Jan 9, 2026
51 checks passed
@sberan sberan deleted the motion-detection-input-parameter branch January 9, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants