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

Jackson integration module incompatible with Jackson > 2.10.5 #306

Open
digitalmisfits opened this issue Dec 18, 2020 · 0 comments
Open

Comments

@digitalmisfits
Copy link

digitalmisfits commented Dec 18, 2020

The jackson integration module is incompatible with Jackson versions > 2.10.5.

A backwards compatible fix would be:

From:
---
    @Override
    public JsonDeserializer<?> findReferenceDeserializer(ReferenceType type,
                                                         DeserializationConfig config, BeanDescription bean,
                                                         TypeDeserializer typeDeserializer, JsonDeserializer<?> jsonDeserializer) throws JsonMappingException {

        return super.findReferenceDeserializer(type, config, bean, typeDeserializer, jsonDeserializer);
    }
---

To:
---
    @Override
    public JsonDeserializer<?> findReferenceDeserializer(ReferenceType type,
                                                         DeserializationConfig config, BeanDescription bean,
                                                         TypeDeserializer typeDeserializer, JsonDeserializer<?> jsonDeserializer) throws JsonMappingException {

        return this.findBeanDeserializer(type, config, bean);
    }

Accepting PRs?

Test case. Works with 2.10.5, does not work with 2.11.x

public class DeserializerTest {

    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

    static {
        OBJECT_MAPPER.registerModule(new CyclopsModule());
    }

    @Test
    @SneakyThrows
    public void testDeserialize() {
        TestDTO testDTO = OBJECT_MAPPER.readValue("{\"seqOfStrings\": [\"hello\"], \"maybeString\": \"world\"}", TestDTO.class);
        assertThat(testDTO.seqOfStrings).isNotNull();
        assertThat(testDTO.maybeString).isNotNull();
    }

    @Getter
    @ToString
    @RequiredArgsConstructor
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class TestDTO {

        @Valid
        @NonNull
        public final Seq<String> seqOfStrings;

        @Valid
        @NonNull
        public final Option<String> maybeString;
    }
}
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