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
Javascript does not have distinct integer and float types. Therefore, 2.0 and 2 are equal.
When 2.0 is sent to the server (at least in JSON; probably also in Transit, though I've not tested), the server sees it as 2.
If my Vase schema has an attribute of type :float, a run-time error will be generated if the client passes a number that happens to be an integer (even if it was created by code that thinks it is dealing with floats).
This risk of surprise could be avoided if Vase would accept and coerce integers into float fields.
For now, I can work around this with a trivial interceptor, but it would be better if automated.
The following ten lines are a much too verbose way to ensure that one float field works safely!
Javascript does not have distinct integer and float types. Therefore, 2.0 and 2 are equal.
When 2.0 is sent to the server (at least in JSON; probably also in Transit, though I've not tested), the server sees it as 2.
If my Vase schema has an attribute of type
:float
, a run-time error will be generated if the client passes a number that happens to be an integer (even if it was created by code that thinks it is dealing with floats).This risk of surprise could be avoided if Vase would accept and coerce integers into float fields.
For now, I can work around this with a trivial interceptor, but it would be better if automated.
The following ten lines are a much too verbose way to ensure that one float field works safely!
The text was updated successfully, but these errors were encountered: