BigAuto integer ID fields should be returned from the API as a string #7758
Replies: 3 comments
-
While you are right in that you can only load numbers up to 9007199254740991 in a javascript number type, how are you getting autoincremented id's that high in the first place? The autoincremented id of objects in netbox are generally not exposed when creating objects at all afaik. |
Beta Was this translation helpful? Give feedback.
-
The database row ID is exposed in the API in places such as |
Beta Was this translation helpful? Give feedback.
-
NetBox doesn't officially support deployment using CockroachDB, so I'm afraid this can't be classified as a bug. While there may be some viable workaround, recasting all integer fields to strings (as suggested in your earlier PR) would not be tenable. Perhaps there's a mechanism to configure the maximum allowed primary key value within CockroachDB? Or, you might consider writing a shim layer for the API to handle the conversion. Either way, I think ~9 quadrillion is a reasonable limit for the maximum PK value for NetBox objects. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
NetBox version
v3.0.8
Python version
3.9
Steps to Reproduce
When dealing with large row IDs such as those generated by cockroachDB, the JS floating point implementation can alter IDs returned from the API when parsing JSON. This results in nonexistent rows being queried.
As can be seen below the ID in JSON and the ID in JS do not match up.
This results in selection boxes in the web interface being non functional.
Expected Behavior
It should be possible to use the web interface error free and make selections from selection boxes.
Observed Behavior
When using the web interface many errors come up complaining about selections not being valid, this is due to JS mangling the IDs as described above.
Beta Was this translation helpful? Give feedback.
All reactions