v0.3.0
This release contains a few fixes but is mostly to align with the recent release of Protocol Buffers v22.0.
Fixes:
- 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 withprotoc
would result in errors with this repo. This has been fixed. - 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 withprotoc
. This has been fixed. - 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 withprotoc
. This has been fixed. - Fuzz testing identified a couple of patterns of pathological input that caused degenerate performance in the lexer and parser. These have been fixed.
Changes:
- When using
protocompile.WithStandardImports
, the version ofgoogle/protobuf/descriptor.proto
has been updated to match the version included with Protocol Buffers v22.0. Even if not usingprotocompile.WithStandardImports
, sources may refer to new options added in v22.0 and the compiler will accept them. - 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. - 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 thegoogle.golang.org/protobuf/types/descriptorpb
package). To provide an override version, implement aprotocompile.Resolver
that returns a result forgoogle/protobuf/descriptor.proto
that is different from the result supplied when usingprotocompile.WithStandardImports
.
Additions:
- The
linker.Result
interface has a new method namedResolveOptionsType
. This is used to implement the above new strategy for resolving options message types when a compile operation includes an override version ofgoogle/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.