Skip to content

Implement float and boolean to String coercion config #3613

Closed
@Tomasito665

Description

@Tomasito665

Is your feature request related to a problem? Please describe.

Our current string deserializers consider coercion configurations for integer input types (#3608) but not for boolean or floating point number inputs. This is an issue because the library lets users configure float-to-string and boolean-to-string coercion behavior, which the corresponding deserializers do not stick to.

Describe the solution you'd like
Implement the handling for the following coercion configurations:

  • boolean to string coercion config: [Fail, TryConvert, AsNull, AsEmpty]
  • floating point number to string config: [Fail, TryConvert, AsNull, AsEmpty]

Usage example

ObjectMapper mapper = new ObjectMapper();
mapper.coercionConfigFor(LogicalType.Textual).setCoercion(CoercionInputShape.Float, CoercionAction.Fail);
mapper.coercionConfigFor(LogicalType.Textual).setCoercion(CoercionInputShape.Boolean, CoercionAction.Fail);

Additional context
Similar issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions