FasterXML / FasterXML/jackson-databind
`@JsonIgnoreProperties(ignoreUnknown=false)` can not override `DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES=false`
- Lenguaje dominante
- Java
- Estrellas
- 3.7k
- Forks
- 1.5k
- Merge medio
- 3 d 6 h
- PR fusionados (30 d)
- 28
Descripción
**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!
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.