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

Correct handling of unknown proto3 enum values #28

Closed
judah opened this issue Jul 13, 2016 · 1 comment
Closed

Correct handling of unknown proto3 enum values #28

judah opened this issue Jul 13, 2016 · 1 comment

Comments

@judah
Copy link
Collaborator

judah commented Jul 13, 2016

Currently proto-lens returns an error when decoding unknown enum values. It should instead accept and preserve such values.

Quoting the proto3 docs:

During deserialization, unrecognized enum values will be preserved in the message, though how this is represented when the message is deserialized is language-dependent. In languages that support open enum types with values outside the range of specified symbols, such as C++ and Go, the unknown enum value is simply stored as its underlying integer representation. In languages with closed enum types such as Java, a case in the enum is used to represent an unrecognized value, and the underlying integer can be accessed with special accessors. In either case, if the message is serialized the unrecognized value will still be serialized with the message.

judah added a commit to judah/proto-lens that referenced this issue Aug 14, 2017
TODO: consider making the default behavior just default, and add a `*'lax`
combinator to access the underlying value.
@judah
Copy link
Collaborator Author

judah commented Sep 17, 2017

Fixed by #137.

@judah judah closed this as completed Sep 17, 2017
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