-
Notifications
You must be signed in to change notification settings - Fork 181
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
dataType: "decimal" gives a string through the api #101
Comments
Do you see it from REST or node? |
from the loopback explorer |
This is the behavior from the postgresql node.js driver - brianc/node-postgres#353. The main purpose is to avoid loss of decimal data. |
Thanks, that's clarifying a lot. However, I'm running in to trouble while using the validatesNumericalityOf when doing a put request changing another property. validation:
Request
gives:
|
@jlvdh if you don't care about decimal precision or you can guarantee safe precision (21?) you can do something like https://github.com/mirek/node-pg-safe-numbers is doing, but it's global/intrusive on pg, so care must be taken (all other libraries using pg will also use new parser). |
This confused me as well. Also, it seems a little inconsistent. On a PUT I found that the response was a number. When listing the resource, however, it has been converted to a string. |
Related to #58. Closing this issue. Feel free to reopen if needed. |
When using dataType: decimal the api seems to return a string instead of a number.
in model.json:
from the api:
The text was updated successfully, but these errors were encountered: