Skip to content

fix: validate ParameterDef.bounds types at construction #95

@rororowyourboat

Description

@rororowyourboat

Problem

packages/gds-framework/gds/parameters.py:33bounds: tuple[Any, Any] accepts any types. Passing non-comparable values like ("string", object()) will crash at low <= value <= high with a TypeError at runtime.

Fix

Add a @model_validator that checks bounds are comparable (both same type, or both support __le__). Alternatively, constrain the type to tuple[float, float] | tuple[int, int] | None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions