Skip to content

@JsonUnwrapped causes deserializer to silently ignore unknown properties #1061

@kdkeck

Description

@kdkeck

Adding @JsonUnwrapped to any field in a class prevents an UnrecognizedPropertyException from being thrown, ever, regardless of DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES or @JsonIgnoreProperties. (As of databind version 2.5.4.)

If you look at UnwrappedPropertyHandler.processUnwrapped(JsonParser, DeserializationContext, Object, TokenBuffer), you'll see that it iterates over the unwrapped properties and sets each one based on properties found in the TokenBuffer. Nowhere does it check that every property stashed in the TokenBuffer was found in (at least) one of the unwrapped properties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions