protocolbuffers / protocolbuffers/protobuf-javascript
Need to better document that toObject() is *not* proto3 JSON
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 471
- Forks
- 91
- Avg merge
- 3h 57m
- Merged PRs (30d)
- 2
Description
proto3 JSON mapping specifies special output for some well known types (e.g. Timestamp, Duration). However, the generated _pb.js files for these types treats them as regular protobufs.
Repro code:
var tspb = require('google-protobuf/google/protobuf/timestamp_pb.js');
var t = new tspb.Timestamp();
console.log(t.toObject());
Expected output:
0001-01-01T00:00:00Z
Observed output:
{ seconds: 0, nanos: 0 }
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the proto3 JSON mapping linked in the issue and the generated google-protobuf/google/protobuf/timestamp_pb.js behavior shown by the reproduction. Clarify in the documentation that toObject() returns the regular protobuf object for well-known types rather than proto3 JSON, and verify the wording against the provided Timestamp example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100