Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dxos/codec-protobuf

Package Overview
Dependencies
Maintainers
7
Versions
3002
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 0.2.3
  • npm
  • Socket score

Version published
Maintainers
7
Created
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

Package last updated on 25 Sep 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc