node-strava / node-strava-v3

API wrapper for Strava's v3 API, in Node
MIT License
356 stars 109 forks source link

Using json-bigint instead of native JSON to fix long integer id's. #154

Closed jbisson closed 5 months ago

jbisson commented 6 months ago

This is to address this specific issue: https://github.com/node-strava/node-strava-v3/issues/125

markstos commented 5 months ago

Thanks. Can you say more about this change works in testing? Is completely backwards compatible? Does it convert these big numbers into strings?

What can users of this module expect when they upgrade to a version with this change?

jbisson commented 5 months ago

It should be backward compatible yes. The difference is that long ID's will be converted to bigInt class (which support long ID) instead of native javascript integer and their toString() when using it will spit out the proper long integer string representative.

Basically, this change replace the JSON.parse() by the JSONbig.parse() function.

markstos commented 5 months ago

I'll try to get this released this week. Did you see the issue affecting more than Segment Effort IDs in the wild?

jbisson commented 5 months ago

I did not see anything else other than Segment Effort ID's at this point of time but anything that would be using long ID's will have the same issue.