Skip to content

Deserialization of unknown value for enums does not yield default enum value #4403

Closed
@dominik-henning

Description

@dominik-henning

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

i have a class containing a field of an enum type. The data is fetched from an api that can add further possible enum values at any point. I want to guard my implementation by using the JsonEnumDefaultValue.

During the deserialization of an unknown value, instead of the annotated default, a different instance of this enum is returned.

Version Information

2.16

Reproduction

https://github.com/dominik-henning/jackson-databind-enum-deserialization-reproducer

i created a projected containing a test class which shows my usecase and setup.

Expected behavior

When an value is encountered which does not match to a annotated JsonProperty, i would expect that the JsonEnumDefaultValue is returned.

Additional context

The real world example is different, but the project boils the problem down to the bare minimum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    has-failing-testIndicates that there exists a test case (under `failing/`) to reproduce the issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions