evanw / evanw/pbjs

Default values

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
105
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hi! The readme for this project states that

> this library doesn't write out default values. This makes it possible to tell if a field has been written at all or not, which allows for efficient encoding of maps

My understanding is that the protocol itself makes this impossible, as default values will not be sent over the wire at all [1]:

> for scalar message fields, once a message is parsed there's no way of telling whether a field was explicitly set to the default value (for example whether a boolean was set to false) or just not set at all: you should bear this in mind when defining your message types

How is this possible in this library?

[1] https://developers.google.com/protocol-buffers/docs/proto3#default

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.