fix: display protobuf enums as numbers instead of strings#118
Open
krilovskiy wants to merge 1 commit intonats-nui:mainfrom
Open
fix: display protobuf enums as numbers instead of strings#118krilovskiy wants to merge 1 commit intonats-nui:mainfrom
krilovskiy wants to merge 1 commit intonats-nui:mainfrom
Conversation
Changed enum representation from String to Number in protobuf message decoding to correctly display enum values. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Collaborator
|
Sorry for huge delay and thanks for PR. So i'm using protobuf enums view in some projects, imho is often useful to see the label instead of raw int number, as the main goal is to show readable message to user, seeing "1") does not tell me nothing about the value) but i agree that in other cases can be useful. Maybe in the constant string it can also be included the raw enum indentifier, like |
This file contains hidden or 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
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.
Summary
Fixed protobuf enum display to show numeric values instead of verbose constant names.
Problem
When decoding protobuf messages, enum fields were displaying full constant names instead of numeric values:
Before:
After:
Changes
Why
Displaying values of enummake your protobuf display more accurate to it's underlaying data
If someone want to display text, then field should be string, not enum