workfloworchestrator / orchestrator-ui-library

Component library for the orchestrator-ui (v2) which is published in npm
8 stars 3 forks source link

Issue with HTML Input for Floating-Point Annotated value #1092

Open torkashvand opened 4 months ago

torkashvand commented 4 months ago

What happened?

The HTML type="number" input strips the decimal point from our float type (for example: longitude coordinates), leading to incorrect data handling for floating-point numbers.

Steps to Reproduce:

define an annotated field


def validate_longitude(v: float) -> float:
     return v

LongitudeCoordinate = Annotated[
    float,
    AfterValidator(validate_longitude),
    Doc(
        "A longitude coordinate, modeled as a string. "
        "The coordinate must match the format conforming to the longitude "
        "range of -180 to +180 degrees. It can be a floating-point number or an integer. "
        "Valid examples: 40.7128, -74.0060, 180, -180, 0."
    ),
]

then in the generated HTML form enter a floating-point number in the longitude input field. Observe that the decimal point is removed or rounded.

Expected Behavior: Users should be able to input longitude coordinates with decimal precision.

Version

2.2.1

What python version are you seeing the problem on?

Python 3.12

Relevant log output

No response

wouter1975 commented 2 months ago

Mohammed Hi Wouter We found a workaround for this in our side by changing the field to string and writing some validations but the field was really float! so I would say if you have time you can have a look to this issue

Wouter 12:13 PM Ok, I will discuss this with the developers. We are investigating to move the dynamic form instead of uniforms, so we might consider fixing in the new dynamic forms (might take a while).