You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can now use maps:
```protobuf
message MapTypes {
map<string, string> stringMap = 1;
}
```
They are deserlialized as ES6 `Map`s and can support keys of any type
- n.b. protobuf.js deserializes maps as `Object`s and only supports
round tripping string keys.
Copy file name to clipboardexpand all lines: packages/protons/README.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -69,10 +69,12 @@ It does have one or two differences:
69
69
2. All 64 bit values are represented as `BigInt`s and not `Long`s (e.g. `int64`, `uint64`, `sint64` etc)
70
70
3. Unset `optional` fields are set on the deserialized object forms as `undefined` instead of the default values
71
71
4.`singular` fields set to default values are not serialized and are set to default values when deserialized if not set - protobuf.js [diverges from the language guide](https://github.com/protobufjs/protobuf.js/issues/1468#issuecomment-745177012) around this feature
72
+
5.`map` fields can have keys of any type - protobufs.js [only supports strings](https://github.com/protobufjs/protobuf.js/issues/1203#issuecomment-488637338)
73
+
6.`map` fields are deserialized as ES6 `Map`s - protobuf.js uses `Object`s
72
74
73
75
## Missing features
74
76
75
-
Some features are missing `OneOf`, `Map`s, etc due to them not being needed so far in ipfs/libp2p. If these features are important to you, please open PRs implementing them along with tests comparing the generated bytes to `protobuf.js` and `pbjs`.
77
+
Some features are missing `OneOf`s, etc due to them not being needed so far in ipfs/libp2p. If these features are important to you, please open PRs implementing them along with tests comparing the generated bytes to `protobuf.js` and `pbjs`.
0 commit comments