-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Map fields with empty string as key are handled incorrectly #843
Comments
It does not assume that protobuf map keys are strings, it just makes any map keys strings on the JS-side because that's how it works in JavaScript. For example, long ints are converted to an 8 bytes hash string and there are utility functions to convert / generate these keys. Other values are simply converted to strings to be usable as a JS object key. |
@dcodeIO Thanks and sorry, I have jumped too quick to conclusions. So only empty strings are mishandled. |
I have fixed the codegen in my fork and I will create a PR soon. |
protobuf.js version: 6.8.0
UPDATED:
Current codegen for map-fields when string key is empty is incorrect.
ORIGINAL:
Current codegen for map-fields is invalid. It assumes that map keys are non empty (!) strings (!!).
Map CAN be indexed by something different than string...Both parsing and JS representation (Object instead of Map) are broken.The text was updated successfully, but these errors were encountered: