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

Add global config override setting for @JsonFormat.lenient() #2424

Closed
cowtowncoder opened this issue Aug 17, 2019 · 1 comment
Closed

Add global config override setting for @JsonFormat.lenient() #2424

cowtowncoder opened this issue Aug 17, 2019 · 1 comment
Milestone

Comments

@cowtowncoder
Copy link
Member

As of 2.9, config overrides system supports global defaults for @JsonInclude and @JsonSetter (as well as some other settings). This is almost everything that can be overridden on per-type (Class) bases, except for one thing: @JsonFormat is overridable on per-type basis but not globally.
The reason for this is that most settings do not make sense in general context: for example, setting Shape default for everything is unlikely to make sense in most cases.

But although most settings are not useful, one thing is: "leniency". Global default currently something like "implicitly enabled", but there is no way to change that: instead, type overrides must be applied to change leniency to "strict" (that is, disabled).

So, let's add setting in 2.10.

Note that 3.0 is planned to introduce an intermediate level of "Type categories" (so, something like "all date/time types", "all numbers", "all sequences", "all map-like") which may then allow @JsonFormat overrides for wider groups. But there is still need for global leniency setting.

@cowtowncoder
Copy link
Member Author

Added:

ObjectMapper.setDefaultLeniency(Boolean)

and wiring to make it click as well as (for now) basic tests for only core JDK types affected (java.util.Date, java.util.Calendar).

But will follow-up with boolean/Boolean deserializer improvements next.

@cowtowncoder cowtowncoder added this to the 2.10.0.pr2 milestone Aug 20, 2019
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

1 participant