Open
Description
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