Skip to content

External type property (@JsonTypeInfo(include = As.EXTERNAL_PROPERTY)) deserialized even if visible = false #1329

@rocketraman

Description

@rocketraman

versions: Jackson 2.8.1, Jackson-module-kotlin 2.8.1

Since I am running into issue #1328 with external property deserialization, I am falling back to a secondary non-enum field which is used by the mapper instead. However, I don't care about the value of this secondary field, so I set visible to false. However Jackson deserializes the external type value despite visible=false. In version 2.6.7 visible=false in the exact same scenario had the correct behavior.

Reproduction recipe:
https://github.com/rocketraman/jackson-issue-enum-polymorphism/blob/master/src/main/kotlin/visibility/Reproduction-VisibleFalse.kt

The output of the program should be:

Invite(kind=CONTACT, kindForMapper=null, to=InviteToContact(name=Foo))

but it is:

Invite(kind=CONTACT, kindForMapper=CONTACT, to=InviteToContact(name=Foo))

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions