Skip to content

v1.13.0

Compare
Choose a tag to compare
@jhump jhump released this 13 Sep 21:32
bccb0aa

This version includes mostly bug fixes. It does include some new API and features in desc/builder and desc/sourceinfo packages. This version also introduces support for Windows. (Some packages did not work correctly on platforms where the default path separator was not /. These packages have been fixed.)

"github.com/jhump/protoreflect/desc"

Changes/fixes:

  • If using the CreateFileDescriptor functions to convert descriptor protos into "rich" descriptors, a panic could occur on certain kinds of invalid input. For example, if the input type of an RPC method referred to an enum instead of a message, a type assertion panic would be triggered. This has been fixed so that such incorrect input results in the function returning an error, not panic'ing.

"github.com/jhump/protoreflect/desc/builder"

Additions:

  • Adds a new method PruneUnusedDependencies to the FileBuilder type. This can be used to remove any unused dependencies. This is mainly useful when modifying an existing descriptor and removing elements from it. After removing elements, some of the file's imports may no longer be used.

"github.com/jhump/protoreflect/desc/protoparse"

Changes/fixes:

  • Fixes a potential panic when parsing and linking source files. If the source contains a symbol that conflicted with the name of a synthetic oneof (an implementation detail of how descriptors with "proto3 optional" fields are generated), it would trigger a nil de-reference panic while trying to construct the error message. This has been fixed.
  • Fixes a subtle issue when resolving relative references in field types and extendees, whereby this package would previously accept a reference that protoc would reject. The resolution rules in protoc handle partially-qualified references a little differently than unqualified references, and this package didn't previously implement the subtle difference. This is now fixed.
  • Fixes an issue where a field type was allowed to directly refer to the name of a synthetic map entry message. This is not actually allowed by protoc. Now such an incorrect usage results in an appropriate error.
  • Adds checks to verify that default JSON names for fields and enum values do not conflict. This implements the check in the same fashion as protoc, which is case-insensitive. For enum values, any prefix on the value name that matches the enum name (regardless of case or underscores) is disregarded when performing this check. The check results in an error for proto3 syntax files, but only a warning for proto2 syntax files.
  • Adds a check to make sure that custom json_name options on fields are valid. So if two fields try to declare the same json_name, this will be considered an error. For proto3 syntax files, if a custom json_name option conflicts with another field's default JSON name, this is also an error (but only a warning for proto2 syntax files).
  • The ParseFilesButDoNotLink method will now return uninterpreted options in a form that matches the way the official C++ Parser class does. In particular, aggregate values now use the same string format, which will be identical to the original message literal in source but without the enclosing braces ({ and }), with all comments and whitespace removed, and with a single space inserted between lexical elements.

"github.com/jhump/protoreflect/desc/protoprint"

Changes/fixes:

  • Previously, characters outside US ASCII (7 bit) in string literals would be encoded using octal escapes when printed. (There is not enough information in a descriptor to preserve the original source's encoding.) This made string literals with other unicode code points (other languages/alphabets, emoji, etc) impossible to read. This has been fixed. String literals used for bytes fields still use aggressive octal escapes. But for string fields, escapes are only used for non-printable code points.

"github.com/jhump/protoreflect/dynamic"

Changes/fixes:

  • The GetKnownType method of KnownTypeRegistry could previously return an invalid type, if given the fully-qualified name of a synthetic map entry message. It now returns nil in such a case.

"github.com/jhump/protoreflect/desc/sourceinfo"

Additions:

  • This release adds a new RegisterEncodedSourceInfo function, used by newer code generated by protoc-gen-gosrcinfo. It accepts compressed encoded data in the form of a byte array.

"github.com/jhump/protoreflect/desc/sourceinfo/cmd/protoc-gen-gosrcinfo"

Changes/fixes:

  • The generated code now emits compressed information. That way, it uses less space in the executable, resulting in smaller binaries.