Skip to content
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

Should be possible to deserialize unknown enum values #92

Open
torkelrogstad opened this issue Feb 1, 2023 · 0 comments
Open

Should be possible to deserialize unknown enum values #92

torkelrogstad opened this issue Feb 1, 2023 · 0 comments

Comments

@torkelrogstad
Copy link

Consider the following Proto file:

message Foo {
  MyEnum my_enum = 1;
}

enum MyEnum {
  MY_ENUM_UNSPECIFIED = 0;
  MY_ENUM_BAR = 1;
  MY_ENUM_QUX = 2;
}

I'm interested in receiving JSON-encoded Foo messages where the enum might have more values added to it later, without me having to update my Proto file and re-generate code. Both of these JSON blobs deserialize fine: {"myEnum": "MY_ENUM_UNSPECIFIED"} and {"myEnum": 1}. However, these two won't work: {"myEnum": "MY_ENUM_BUX"} and {"myEnum": 100}.

It would be great if some sort of mechanism could be added to tolerate unknown enum values.

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

No branches or pull requests

1 participant