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

CoercionConfigs (2.12): make existing coercions configurable #2750

Closed
cowtowncoder opened this issue Jun 8, 2020 · 3 comments
Closed

CoercionConfigs (2.12): make existing coercions configurable #2750

cowtowncoder opened this issue Jun 8, 2020 · 3 comments
Labels
coercion-config Issue related to 2.12 added "CoercionConfig"

Comments

@cowtowncoder
Copy link
Member

Now that #2113 -- core system for configuring allowed coercions -- has been implemented, what is needed next is to change actual deserializers to make use of configuration. This mostly covers existing implicitly allowed coercions (or possibly, blocked). So far existing changes cover:

  • Allowing coercion from empty String (and in case of XML, blank) into POJOs, Collections/arrays, Maps -- and possibly many other types (if they extend StdDeserializer, or deserializers that extend it).
  • Allowing String coercion into primitives (mostly numbers, but also booleans/Booleans).

but most other things are not yet checked.

I created this placeholder issue to allow users to comment; I will likely create separate issues for individual deserializer changes (or some grouping of those).

@cowtowncoder
Copy link
Member Author

cowtowncoder commented Jun 8, 2020

Just to seed discussion, here are some thoughts:

  1. Boolean type: allowing (or not) use of integer number values (as of now, coercion from 0 is false, non-0 true) -- and (I have to check this), verify if floating-point numbers are blocked or not
  2. JDK string-like types: verify existing EmptyString coercion
  3. Date/time types (Joda, Java 8); at least check EmptyString handling. Probably same for floating-point numbers, and (in case Array type is not standard serialization), arrays.
  4. Guava: verify that Collection, Map follow EmptyString coercion

Some existing tickets that seem relevant too:

Finally, I added coercion-config label to use for these issues.

@cowtowncoder cowtowncoder added the coercion-config Issue related to 2.12 added "CoercionConfig" label Jun 8, 2020
@cowtowncoder cowtowncoder changed the title 2.12, CoercionConfigs: existing coercions to make configurable (placeholder) 2.12, CoercionConfigs: make existing coercions configurable Jun 10, 2020
@cowtowncoder
Copy link
Member Author

Implemented, at least:

  • All existing coercions to boolean/Boolean (from String, integer number) converted to use new mechanism (but old ones also work)
  • Float-to-integer checks similarly upgraded
  • Coercion from empty String to Map verified
  • From-empty-String coercions for JDK scalar types verified

This leaves

  • Java 8 date/time
  • Collection types (Guava esp)
  • Possible additional leniency settings for boolean

@cowtowncoder
Copy link
Member Author

Implemented "Empty String" coercion checks for Joda and Java 8 date-time types.

Will need to add one new coercion config check wrt Enums but will file separate issue for that.

@cowtowncoder cowtowncoder changed the title 2.12, CoercionConfigs: make existing coercions configurable CoercionConfigs (2.12): make existing coercions configurable Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coercion-config Issue related to 2.12 added "CoercionConfig"
Projects
None yet
Development

No branches or pull requests

1 participant