Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Decimal-backed Coordinates with string-based serialization #284

Open
navignaw opened this issue Jan 11, 2025 · 0 comments
Open

Support Decimal-backed Coordinates with string-based serialization #284

navignaw opened this issue Jan 11, 2025 · 0 comments

Comments

@navignaw
Copy link

Coordinate currently takes a float as input.

Would it be possible to support either a float or Decimal? The main benefit would be using string serialization to preserve precision.

I'm not sure if this applies to pydantic, but in marshmallow docs, there is a warning about using floats:

If a JSON float value is passed to this field for deserialization it will first be cast to its corresponding string value before being deserialized to a decimal.Decimal object. The default str implementation of the built-in Python float type may apply a destructive transformation upon its input data and therefore cannot be relied upon to preserve precision. To avoid this, you can instead pass a JSON string to be deserialized directly.

(If this is not true for pydantic, feel free to close this issue!)

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

No branches or pull requests

1 participant