-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Disable Jackson's FAIL_ON_UNKNOWN_PROPERTIES by default #13361
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document that the default Jackson ObjectMapper is customized by default.
Is it the only customization that we wants by default (I usually always disabled date as timestamp as we better off with ISO dates for interoperability).
I think we must provide more configuration options for the more customized features of Jackson. Or maybe we can have "generic configuration" where a developer can use :
quarkus.jakson.feature.<feature-name>=value
?
...ions/jackson/deployment/src/main/resources/application-fail-on-unknown-properties.properties
Outdated
Show resolved
Hide resolved
So to be honest, I'm not for having all the features in the config. People who want to customize Jackson can do it with a customizer, that's practical enough. So for me it's really about:
I will write the docs once we agree on the idea. |
430d9da
to
888157a
Compare
@gsmet OK for me then.
I think serializing dates as ISO (as JSON-B) is a better default than timestamp. Keep in mind that it will be a breaking change for the frameworks that currently uses the default ObjectMapper (AWS Lambda, Funqy, GCP Functions, Azure Functions at least). |
+1 for this. But we do need to communicate that this is a breaking change |
I'm not exactly sure about the timestamp change format. @geoand WDYT? |
I like the idea, +1 |
888157a
to
1ab6f06
Compare
@geoand so I tried to make the config It somehow doesn't work: no injection errors but the injected bean does not have the configured value. I ended up using the usual As for the timestamp, I'll let others do the work. I have no idea what it does and doesn't really have time to experiment. Now that the infrastructure is here, it should be easy enough. If nobody takes it, I'll take care of it sometime next week. Now let's see if CI prefers this version. |
Fail on properties is good. But timestamp seems like it risk breaking many or ? |
I think it's a reasonable default but indeed it's another breaking change. We can certainly leave it out for now |
1ab6f06
to
ca37045
Compare
ObjectMapper objectMapper = new ObjectMapper(); | ||
if (!jacksonConfigSupport.isFailOnUnknownProperties()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to have this first, as it allows users to override the behavior with their own customizers if need be
@@ -186,6 +186,11 @@ It will allow to narrow down the number of JAX-RS providers (which can be seen a | |||
|
|||
==== Jackson | |||
|
|||
In Quarkus, Jackson is configured to ignore the unknown properties (by disabling the `DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES` feature). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to add a note that this only works for the ObjectMapper configured by Quarkus and which they obtain via CDI (or use implicitly via RESTEasy etc).
I know it should be evident, but I am sure it might come as a surprise to some users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Also provide a way to go back to the previous behavior.
ca37045
to
542cb50
Compare
You're right, it's not obvious, I added some precisions. |
This is what was discussed on the mailing list.
Commits should be reviewed separately as the first one is a cleanup commit, renaming a file.
/cc @maxandersen @loicmathieu @geoand