FasterXML / FasterXML/jackson-databind
`@JsonIgnoreProperties(ignoreUnknown=false)` can not override `DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES=false`
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 1.5k
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 28
Description
**Description**
I'm not sure if this is a bug or a desired behavior, but in my opinion it's a bug. Here's what happens:
When you set ```DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES``` to ```false``` in an object mapper, the observed behavior is the expected, no exceptions are thrown, even if the JSON contains unknown properties.
However, if in combination with this config you annotate a bean with ```@JsonIgnoreProperties(ignoreUnknown = false)```, the behavior should change (in my opinion), since the annotation takes precedence over the configuration in the object mapper.
The annotation clearly states that the unknown properties should not be ignored, so, the expected behavior is that an excpetion is thrown.
I've searched the repository issues, but couldn't find this problem reported anywhere. Maybe, the only issue related to this is #1523, but it needs further investigation to confirm.
**Version information**
Tested with jackson-databind 2.12.1
**To Reproduce**
It's kinda hard to explain here how to reproduce. So, I created a project with some test that you can run to verify the behavior:
[JacksonBugTest.zip](https://github.com/FasterXML/jackson-databind/files/6026808/JacksonBugTest.zip)
Import the project on your IDE (Gradle support/plugins must be enabled) or run the tests with:
**Linux:** ```./gradlew test -i```
**Windows:** ```gradlew.bat test -i```
Alternatively, you can view the report generated by my test run:
[test-report.zip](https://github.com/FasterXML/jackson-databind/files/6026827/test-report.zip)
Feel free to contact me if you have any doubts: noschang@univali.br
Thank you for your attention and congratulations for the excellent work you have been doing for the community!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.