FasterXML / FasterXML/jackson-databind

`@JsonIgnoreProperties(ignoreUnknown=false)` can not override `DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES=false`

オープン
#3,067 コメント 10 件 リアクション 10 件 担当者 0 名 GitHub で見る
3.x has-failing-test most-wanted
主要言語
Java
スター
3.7k
フォーク
1.5k
平均マージ
3日 6時間
マージ済み PR(30日)
28

説明

**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!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。