Closed cabo closed 1 year ago
I tried to follow the issue conversation. As I understand it, we have to quote things because not every JSON implementation supports the full range of the uint64, and might turn it into an int64?
The JSON standard uses 56 bit numbers I think. The 64 bit YANG types must be encoded as a string in JSON.
On 2023-02-24, at 19:06, Michael Richardson @.***> wrote:
I tried to follow the issue conversation. As I understand it, we have to quote things because not every JSON implementation supports the full range of the uint64, and might turn it into an int64?
Full explanation in I-JSON, RFC7493
Short form: JSON uses a number system that is not further specified (like so many things in JSON). Many implementations use IEEE 754 binary64 for all numbers, which has 53 bits of precision. Numbers ≥ 2**53 lose their lower order bits on these implementations, so they are not interoperable where exact numbers are required (which is clearly true for YANG-SIDs).
So YANG-JSON (RFC 7951) decided to pack int64 and uint64 as decimal numbers into text strings. We have to follow.
By the way, YANG-SIDs are 63-bit integers (0..9223372036854775807). There is no confusion between int64 and uint64, as this information comes out of the YANG model.
Grüße, Carsten
Close #149