jakartaee / jakartaee/jsonb-api
Any way to globally opt-out of JSONB's "Must-Ignore" policy?
- Dominant language
- Java
- Stars
- 95
- Forks
- 41
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 35
Description
I am attempting to change the implementation of some code to use JSON-B instead of Jackson. In the process of doing so, I would like to match behavior so existing users are not impacted. One key behavior difference I have found is during deserialization Jackson will reject unrecognized properties, whereas JSON-B will simply ignore unrecognized properties.
I was looking around the API for a way to reject unrecognized properties (ideally via `JsonbConfig`). I posted [this question on SO](https://stackoverflow.com/questions/46347852/how-to-reject-deserialization-of-unrecognized-with-json-b), but eventually I ran across this section of the JSON-B spec:
> **3.18 Must-Ignore policy**
When JSON Binding implementation during deserialization encounters key in key/value pair that it does not recognize, it should treat the rest of the JSON document as if the element simply did not appear, and in particular, the implementation MUST NOT treat this as an error condition.
So this explains why the default behavior is the way it is... but is there any way to opt-out of this? It would be a key part of migrating existing applications from Jackson to JSON-B.
Contributor guide
Research direction
Start by reviewing JsonbConfig and the JSON-B specification's section 3.18, the Must-Ignore policy, to determine whether an opt-out is permitted. Define what a global rejection option should mean for unrecognized properties and verify the behavior against migration expectations from Jackson; the issue names no source files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100