Skip to content

fix: display protobuf enums as numbers instead of strings#118

Open
krilovskiy wants to merge 1 commit intonats-nui:mainfrom
krilovskiy:fix/protobuf-enum-display
Open

fix: display protobuf enums as numbers instead of strings#118
krilovskiy wants to merge 1 commit intonats-nui:mainfrom
krilovskiy:fix/protobuf-enum-display

Conversation

@krilovskiy
Copy link
Copy Markdown

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:

"severity_number": "SEVERITY_NUMBER_INFO"

After:

"severity_number": 1

Changes

  • Changed enums: String to enums: Number in frontend/src/utils/protobuf.ts

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

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>
@pricelessrabbit
Copy link
Copy Markdown
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 "severity_number": "SEVERITY_NUMBER_INFO[1]"

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.

2 participants