Skip to content

Add MapperFeature.ALLOW_COERCION_OF_SCALARS for enabling/disabling coercions #1106

@cowtowncoder

Description

@cowtowncoder

(see #200 for background; #1095 also)

While existing features should cover cases of allowing (or not) of coercion from null to primitive (FAIL_ON_NULL_FOR_PRIMITIVES), as well as coercion from empty String to primitive via null (as per #1095), there is no way to block other coercions from JSON Strings (primarily) or, in case of boolean/Boolean, from integral numbers.

To allow preventing such coercions, it would make sense to add yet another DeserializationFeature, named something like ALLOW_COERCION_FOR_SCALARS, defaulting to true to keep current behavior as the baseline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions