Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement float and boolean to String coercion config #3613

Closed
Tomasito665 opened this issue Oct 4, 2022 · 0 comments
Closed

Implement float and boolean to String coercion config #3613

Tomasito665 opened this issue Oct 4, 2022 · 0 comments
Milestone

Comments

@Tomasito665
Copy link
Contributor

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:

@Tomasito665 Tomasito665 added the to-evaluate Issue that has been received but not yet evaluated label Oct 4, 2022
@cowtowncoder cowtowncoder removed the to-evaluate Issue that has been received but not yet evaluated label Oct 4, 2022
Tomasito665 added a commit to Tomasito665/jackson-databind that referenced this issue Oct 5, 2022
Tomasito665 added a commit to Tomasito665/jackson-databind that referenced this issue Oct 5, 2022
@cowtowncoder cowtowncoder changed the title Implement float and boolean to string coercion config Implement float and boolean to String coercion config Oct 5, 2022
@cowtowncoder cowtowncoder added this to the 2.14.0 milestone Oct 5, 2022
cowtowncoder added a commit that referenced this issue Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants