Skip to content
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

Long to number exception in protobuf maps #1128

Open
Renat060888 opened this issue Oct 23, 2024 · 0 comments
Open

Long to number exception in protobuf maps #1128

Renat060888 opened this issue Oct 23, 2024 · 0 comments

Comments

@Renat060888
Copy link

Renat060888 commented Oct 23, 2024

Hello!
I encountered a problem with uint64-keys in protobuf maps when I try to call toJSON() method - in case of quite big number it throws an exception: "Value is larger than Number.MAX_SAFE_INTEGER"

I noticed that regular uint64-fields are converted like this:
obj.objectId = (message.objectId || Long.UZERO).toString();

While maps try to do it like this:
message.floorNames.forEach((v, k) => { obj.floorNames[longToNumber(k)] = v; });

Why do the approaches differ here? Is this done on purpose?
I haven't found any flag to change the way the code is generated.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant