You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today we have this option: floats: :decimal | :native.
It works pretty when you want Decimal.t() from instead of float, however if the API you're consuming sometimes outputs 3 (integers), you get a native integer number after decoding. So the rest of the code has to handle Decimal.t() or integer() types, or add a code to normalise it before exposing it to the rest of the application.
I wonder if it would be better or possible to have a option like numbers: :binary | :decimal | :native instead. So you could have all numbers normalised in a single shape right (String.t() | Decimal.t() | number()) after decoding.
What do you think?
The text was updated successfully, but these errors were encountered:
Hi,
Today we have this option:
floats: :decimal | :native
.It works pretty when you want
Decimal.t()
from instead of float, however if the API you're consuming sometimes outputs3
(integers), you get a native integer number after decoding. So the rest of the code has to handleDecimal.t()
orinteger()
types, or add a code to normalise it before exposing it to the rest of the application.I wonder if it would be better or possible to have a option like
numbers: :binary | :decimal | :native
instead. So you could have all numbers normalised in a single shape right (String.t() | Decimal.t() | number()
) after decoding.What do you think?
The text was updated successfully, but these errors were encountered: