minimum
and maximum
property are restricted to f64. Which looks weird and its also encoding wrong for large numbers.
#910
Labels
enhancement
New feature or request
Description of the feature
Currently Poem defines
minimum
andmaximum
as f64.When it encodes the openapi it results in things like this:
Note the type is an integer, but the min/max are floats which confusingly suggests that I could set a value of 6.8 and it be valid. Which is not correct.
Also, using floats corrupts large numbers as f64 can not encode above 2^53 without losing precision.
If I have a value that can be larger than that, which is stored in a u64, the document is wrong.
It should be possible to select if the min/max are floats or integers. If they are integers, ideally they would support large values.
Instead of f64, min/max could be encoded with
https://crates.io/crates/bigdecimal
and if the type is an "integer" the value is serialized without any decimal place, if its a "float" the min/max serializes with a decimal place.This way there would be no arbitrary limit on the parameter, and the min/max would follow the underlying type.
This is an example where the maximum results in invalid data in the document:
The text was updated successfully, but these errors were encountered: