Socket
Socket
Sign inDemoInstall

@dxos/codec-protobuf

Package Overview
Dependencies
73
Maintainers
6
Versions
2548
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @dxos/codec-protobuf

There's an associated @dxos/protobuf-compiler package that does codegen based on protobuf schema.


Version published
Maintainers
6
Install size
9.50 MB
Created

Readme

Source

codec-protobuf

There's an associated @dxos/protobuf-compiler package that does codegen based on protobuf schema.

Handling of scalar fields with default values

Based on:

In protobuf scalar fields (numbers, booleans, strings, bytes, enums) may have an implicit default value:

  • 0 for number types
  • false for booleans
  • '' (empty string) for strings
  • [] for bytes
  • First enum value for enums

Non-optional fields

Example:

int32 number = 1;

If the field is set to it's default value (0 in this example) it MAY be missing in the wire encoding (Go implementation) or present with the value set to 0 (JS implementation).

When decoding, the missing fields MUST be treated as having the default implicit value (0 in this case).

Optional fields

optional int32 number = 1;

If the field is set to it's default value (0 in this example) it MUST be present in the wire encoding with the value set to 0.

When decoding, the missing fields it MUST be set as undefined. If the field is present in the wire format, it must be set to its numeric value.

Toolchain

This package must NOT use toolchain to avoid cyclic dependencies.

FAQs

Last updated on 17 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc