Skip to content

Conversation

mkruskal-google
Copy link
Contributor

This extension had virtually no test coverage and was already fairly buggy in proto2/proto3. The addition of editions support broke it completely though, notably #2068 which added some caching that doesn't work in the case of root-less types.

This PR adds some basic test coverage, and cleans up the code to work more smoothly under editions. It is still not safe to use it in the following cases, where it will produce bad results:

  • Converting descriptors from one syntax/edition to another
  • Loading partial editions descriptors (e.g. calling fromDescriptor on anything but a Root node)

Fixes #2072

@sofisl sofisl merged commit 6e255d4 into master May 28, 2025
6 checks passed
@github-actions github-actions bot mentioned this pull request May 28, 2025
@mkruskal-google mkruskal-google deleted the descriptor-ext branch May 28, 2025 22:16
josephharrington added a commit to josephharrington/protobuf.js that referenced this pull request Aug 14, 2025
A recent change (protobufjs#2075) edited descriptor.proto to include a `reserved`
statement that combines a field number and field name in the same line.
This is specifically called out in the proto language guide as invalid.

https://protobuf.dev/programming-guides/editions/#reserved

> Note that you can’t mix field names and numeric values in the same
> `reserved` statement.

Protobuf.js itself seems to handle this syntax just fine, but other
tools like protoc will choke on it.
mkruskal-google pushed a commit that referenced this pull request Aug 15, 2025
A recent change (#2075) edited descriptor.proto to include a `reserved`
statement that combines a field number and field name in the same line.
This is specifically called out in the proto language guide as invalid.

https://protobuf.dev/programming-guides/editions/#reserved

> Note that you can’t mix field names and numeric values in the same
> `reserved` statement.

Protobuf.js itself seems to handle this syntax just fine, but other
tools like protoc will choke on it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v7.5.2 breaks protobuf.Type.encode and protobuf.Type.create methods
3 participants