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

ensure_numeric in JSON.Decoder breaks when the string is an integer. not a float #220

Closed
IceDragon200 opened this issue Sep 23, 2024 · 1 comment

Comments

@IceDragon200
Copy link
Contributor

This commit introduced a regression where coordinates that exclude their decimal point (i.e. an integer format) are now unable to decode since:

iex(1)> String.to_float("12")
** (ArgumentError) errors were found at the given arguments:

  * 1st argument: not a textual representation of a float

    :erlang.binary_to_float("12")
    iex:1: (file)
iex(1)> String.to_float("12.0")
12.0
s3cur3 added a commit that referenced this issue Sep 23, 2024
This fixes a sort-of-regression introduced in #218 (released as v4.0.0) where string values that contained only integers would previously have been passed on by the JSON parser (leading to values like `%Geo.Point{coordinates: {"12", "24"}}`) but now raise an error. Since we can unambiguously parse such values into valid integers, we should just do so.

Resolves #220
@s3cur3
Copy link
Contributor

s3cur3 commented Sep 23, 2024

Resolved by #221

@s3cur3 s3cur3 closed this as completed Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants