Skip to content

v1.7.0

Compare
Choose a tag to compare
@timostamm timostamm released this 24 Jan 17:18
· 123 commits to main since this release
db0bd03

What's Changed

This release adds support for extensions, a Protobuf language feature that allows to extend a message with an additional field.

For example:

syntax = "proto2";

message User {
  extensions 100 to 200;
}

extend User {
  optional uint32 age = 100;
}

For the extension age, we generate a new export const age: Extension<User, number>. You can set the extension field with the function setExtension:

import { setExtension } from "@bufbuild/protobuf";
import { User, age } from "./example_pb.js";

const user = new User();
setExtension(user, age, 77);

To learn more about the details, see the API documentation.

For plugin authors: Since extensions provide a better way to access custom options in a plugin, we are deprecating the findCustom*Option functions from @bufbuild/protoplugin/ecmascript. We recommend to switch to extensions for better type safety and flexibility, see the PR for details.

All changes

Full Changelog: v1.6.0...v1.7.0