-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
JSON Number(double) Insufficient for Long NodeID #5716
Comments
The JSON spec does not appear to limit the range of a number at all(!) https://www.json.org/json-en.html. JSON Schema seems to, I think, as 32 bit signed: -2,147,483,648 ... 2,147,483,647 . Google notes a work around of
As a workaround in this case, is it possible for you to use a string-id instead (i.e. trivially convert to-string for osrm, then convert to-int on return)? |
@awgrover Actually I already returned |
This issue seems to be stale. It will be closed in 30 days if no further activity occurs. |
We use
annotations=true
to outputnodes
in route response, then we found the outputnodes
may invalid sometimes.After investigate, it's caused by the JSON util only has one number type
Number
, which defined asdouble
:osrm-backend/include/util/json_container.hpp
Lines 89 to 94 in 15f0ca8
It means whatever the internal number type is, it will be converted to
double
before output. For some longstd::uint64_t
, the value will be cut in this conversion.In our test, the nodeID
9280805980001101
will be cut to9280805980001100
, which results invalid nodeID.Here's some test code:
Full story please refer to Telenav#276
Any suggestion? Is it possible to have more Number types in the JSON util?
Many thanks in advance!
The text was updated successfully, but these errors were encountered: