-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUGFIX: Add support for nested definitions in Python mcap-protobuf-support #1321
Open
methylDragon
wants to merge
1
commit into
foxglove:main
Choose a base branch
from
methylDragon:ch3/nested-proto-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+99
−2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
methylDragon
requested review from
jtbandes,
james-rms and
indirectlylit
as code owners
January 26, 2025 12:17
methylDragon
force-pushed
the
ch3/nested-proto-support
branch
2 times, most recently
from
January 26, 2025 12:23
a90cda9
to
7943adb
Compare
Signed-off-by: methylDragon <methylDragon@gmail.com>
methylDragon
force-pushed
the
ch3/nested-proto-support
branch
from
January 26, 2025 12:25
7943adb
to
e1f655a
Compare
copybara-service bot
pushed a commit
to protocolbuffers/protobuf
that referenced
this pull request
Jan 26, 2025
Otherwise downstream callers must explicitly fetch and generate message classes for nested definitions. (For example [here](foxglove/mcap#1321).) Example: ``` message NestedTypeMessage { message NestedType { string data = 1; } NestedType nested = 1; } ``` Currently `GetMessageClassesForFiles()` will only return `NestedTypeMessage`, but miss `NestedTypeMessage.NestedType` (and any arbitrary level of nested definitions). This is an unexpected deviation from the comment that says that it will find and resolve all dependencies. PiperOrigin-RevId: 719854337
copybara-service bot
pushed a commit
to protocolbuffers/protobuf
that referenced
this pull request
Jan 26, 2025
Otherwise downstream callers must explicitly fetch and generate message classes for nested definitions. (For example [here](foxglove/mcap#1321).) Example: ``` message NestedTypeMessage { message NestedType { string data = 1; } NestedType nested = 1; } ``` Currently `GetMessageClassesForFiles()` will only return `NestedTypeMessage`, but miss `NestedTypeMessage.NestedType` (and any arbitrary level of nested definitions). This is an unexpected deviation from the comment that says that it will find and resolve all dependencies. PiperOrigin-RevId: 719854337
copybara-service bot
pushed a commit
to protocolbuffers/protobuf
that referenced
this pull request
Jan 26, 2025
Otherwise downstream callers must explicitly fetch and generate message classes for nested definitions. (For example [here](foxglove/mcap#1321).) Example: ``` message NestedTypeMessage { message NestedType { string data = 1; } NestedType nested = 1; } ``` Currently `GetMessageClassesForFiles()` will only return `NestedTypeMessage`, but miss `NestedTypeMessage.NestedType` (and any arbitrary level of nested definitions). This is an unexpected deviation from the comment that says that it will find and resolve all dependencies. PiperOrigin-RevId: 719854337
methylDragon
changed the title
Add support for nested definitions in Python mcap-protobuf-support
BUGFIX: Add support for nested definitions in Python mcap-protobuf-support
Jan 27, 2025
james-rms
reviewed
Jan 27, 2025
) | ||
while nested_descriptions: | ||
nested_desc = nested_descriptions.pop() | ||
nested_messages[nested_desc.full_name] = GetMessageClass( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this not mutate messages
directly?
james-rms
approved these changes
Jan 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for the fix!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changelog
Bugfix: Support nested message definitions in mcap-protobuf-support
Description
Consider the following Protobuf definition:
Currently the decoder's use of the
protobuf.GetMessageClassesForFiles()
misses out the innerNestedType
definition, causing decoding failures from missing nested descriptors, even though those descriptors would have been populated as part of the encoded file descriptors in an MCAP file.The error that is raised is something like:
FileDescriptorSet for type {schema.name} is missing that schema
This issue persists to an arbitrary level of nesting.
This PR fixes that issue (including for deeply nested definitions) and adds a unit test to prevent regression.
PS:
How soon after merging this will it make it to PyPI?