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

Respect deserialization of enums using toString() #1104

Merged
merged 1 commit into from Jun 18, 2015

Conversation

Projects
None yet
5 participants
@arteam
Member

arteam commented Jun 6, 2015

If Jackson if configured with READ_ENUMS_USING_TO_STRING feature, PermissiveEnumDeserializer should respect it and let Jackson to correctly deserialize an enum using its toString method.

Fix #1098

@coveralls

This comment has been minimized.

coveralls commented Jun 6, 2015

Coverage Status

Coverage increased (+0.02%) to 72.2% when pulling 6f78cbd on arteam:respect_for_deserialize_to_string into b119bb3 on dropwizard:master.

@Test
public void readsEnumsUsingToString() throws Exception {
mapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true);

This comment has been minimized.

@joschi

joschi Jun 6, 2015

Member

The configuration should be changed on a copy of the object mapper. Otherwise different test methods in this class might fail (order isn't guaranteed): ObjectMapper#copy()

This comment has been minimized.

@arteam

arteam Jun 6, 2015

Member

I don't think it's neccesary, because instances of ObjectMapper are not shared between the tests. Every test creates own instance of the mapper, so changes in it don't affect other tests.

This comment has been minimized.

@carlo-rtr

carlo-rtr Jun 18, 2015

Member

@arteam your right about the new instance per test. With that said, I think setup should create the instance and configure it. In mind, that's more transparent. Otherwise, LGTM

This comment has been minimized.

@arteam

arteam Jun 18, 2015

Member

OK, shouldn't be a problem to create a copy.

@jplock jplock added this to the 0.9.0 milestone Jun 9, 2015

Respect deserialization of enums using toString()
If Jackson if configured with *READ_ENUMS_USING_TO_STRING*
feature, `PermissiveEnumDeserializer` should respect it and
let Jackson to correctly deserialize an enum using its
`toString` method.

Fix #1098

carlo-rtr added a commit that referenced this pull request Jun 18, 2015

Merge pull request #1104 from arteam/respect_for_deserialize_to_string
Respect deserialization of enums using toString()

@carlo-rtr carlo-rtr merged commit d77cc80 into dropwizard:master Jun 18, 2015

@arteam arteam deleted the arteam:respect_for_deserialize_to_string branch Jan 24, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment