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

Add config option to fail on unknown enum values #74

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lutovich
Copy link

Hi @jhaber! Thanks for this library, it is very useful :)

We have recently faced an issue related to serialization of unknown enum values coming from a newer version of a proto schema. The issue is the same as described in #58. It would be great to have a way to configure the serializer to fail instead of producing values like UNKNOWN_ENUM_VALUE_TestType_2. For example, fail-fast behavior is desirable to avoid storing JSONs with such values in a database.

This PR adds a configurable UnknownEnumSerializationStrategy interface that handles unknown enum value descriptors. The default behavior is to serialize as-is. New additional behavior is to fail with IllegalArgumentException. The strategy is configurable via ProtobufJacksonConfig.

Could you please take a look at this PR and let me know if you think this is a reasonable suggestion?
Thanks a lot in advance!

@lutovich
Copy link
Author

lutovich commented Aug 3, 2020

Hi @jhaber, could you please take a look at this PR?

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.

1 participant