Skip to content

Should be possible to deserialize unknown enum values #92

Description

@torkelrogstad

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions