Skip to content

v0.3.0

Compare
Choose a tag to compare
@jhump jhump released this 27 Feb 21:51
· 195 commits to main since this release
7c5114e

This release contains a few fixes but is mostly to align with the recent release of Protocol Buffers v22.0.

Fixes:

  1. The reference compiler protoc allows the use of integer literals for enum values inside of a message literal, for custom options whose value is a message type. But this repo did not allow this, so some sources that could be compiled with protoc would result in errors with this repo. This has been fixed.
  2. This repo allowed the message_set_wire_format option to be used in files that declare a syntax of proto3. However, this is not allowed; that option is only acceptable in the proto2 syntax. So this repo would accept some sources that were actually valid and would fail if compiled with protoc. This has been fixed.
  3. This repo allowed certain kinds of relative references when resolving extension names in message literals, for custom options whose value is a message type, that are not allowed by the reference compiler protoc. So this repo would accept some sources that were actually valid and would fail if compiled with protoc. This has been fixed.
  4. Fuzz testing identified a couple of patterns of pathological input that caused degenerate performance in the lexer and parser. These have been fixed.

Changes:

  1. When using protocompile.WithStandardImports, the version of google/protobuf/descriptor.proto has been updated to match the version included with Protocol Buffers v22.0. Even if not using protocompile.WithStandardImports, sources may refer to new options added in v22.0 and the compiler will accept them.
  2. The above v22.0 release included some changes to behavior when validating custom JSON names. In particular, checking for conflicting JSON names is now case-sensitive. Also, custom JSON names may not be enclosed brackets ([ and ]). These changes are now also reflected in validation done by this repo.
  3. If a compile operation provides an override version of google/protobuf/descriptor.proto, it will be used during the options interpretation step. Previously, the was only supported in files that imported override definitions of the options types. If override definitions were not directly imported, options interpretation would always use the version of the options types linked into the compiler program (via the google.golang.org/protobuf/types/descriptorpb package). To provide an override version, implement a protocompile.Resolver that returns a result for google/protobuf/descriptor.proto that is different from the result supplied when using protocompile.WithStandardImports.

Additions:

  1. The linker.Result interface has a new method named ResolveOptionsType. This is used to implement the above new strategy for resolving options message types when a compile operation includes an override version of google/protobuf/descriptor.proto. This is technically a backwards-incompatible change. Such an incompatible change was made because (1) this repo is still pre-v1.0, and (2) this interface is not intended to be implemented by code outside of this repo.