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

Update JacksonAutoConfiguration with safer defaults #16553

Closed
harish-prakash opened this issue Apr 13, 2019 · 2 comments
Closed

Update JacksonAutoConfiguration with safer defaults #16553

harish-prakash opened this issue Apr 13, 2019 · 2 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@harish-prakash
Copy link

Should Boot disable by default FAIL_ON_UNKNOWN_PROPERTIES in the ObjectMapper configuration?

Jackson's stock configuration actually fails deserialization whenever it encounters an unknown property. The only argument against this is Postel's law which has been challenged in recent days

Though RFC 3117 and PoPETS article do not talk about HTTP (Postel's law itself mainly focused on TCP) they are very good examples why unmanaged rejection is not always a good idea.

Furthermore FasterXML's Jackson team had a very good reason why not to blindly follow the law. (reference).

My question is, why would spring decide to deviate from a structured default? I understand the general concern for backward and forward compatibility, would it not be more efficient if implementations explicitly accepted unknown properties and logged them instead of Spring deciding to silently drop them?

Some may find this question intentionally begins the same way its counter-request did a few years ago. Issue #1237

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 13, 2019
@philwebb
Copy link
Member

Every default has a trade off, but I feel like our current approach works well for most of our users. Specifically, I like the fact that the JSON I'm consuming can have additional fields added without my application breaking.

It's also very easy to change the defaults if they don't work for you by adding the following to your application.properties file:

spring.jackson.deserialization.fail-on-unknown-properties=true

@philwebb philwebb added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 13, 2019
@harish-prakash
Copy link
Author

harish-prakash commented Apr 16, 2019

I really cannot argue with

but I feel like our current approach works well

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants