Skip to content

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