Is your feature request related to a problem? Please describe.
When Jackson deserializes a JSON array into a Set, elements considered duplicates by the target Set are silently discarded.
This is normal Set behavior, but it makes deserialization lossy and can hide invalid input. Applications with Set-valued request properties may want to reject duplicate array elements instead of silently canonicalizing them.
Describe the solution you would like
Please consider adding an opt-in deserialization setting that fails when the target Set rejects an array element as a duplicate.
Existing behavior should remain the default for backward compatibility.
The setting could potentially be exposed globally through a DeserializationFeature, per property, or both. The resulting input-mapping error should include the duplicate element array index where possible.
Usage example
The appropriate configuration API should be agreed with the maintainers first.
Additional context
I observed this with Jackson Databind 2.19.2 and could not find an existing issue or pull request for opt-in duplicate rejection during Set deserialization.
I would be willing to contribute an implementation once the desired API and scope are agreed.
Is your feature request related to a problem? Please describe.
When Jackson deserializes a JSON array into a
Set, elements considered duplicates by the target Set are silently discarded.This is normal Set behavior, but it makes deserialization lossy and can hide invalid input. Applications with Set-valued request properties may want to reject duplicate array elements instead of silently canonicalizing them.
Describe the solution you would like
Please consider adding an opt-in deserialization setting that fails when the target Set rejects an array element as a duplicate.
Existing behavior should remain the default for backward compatibility.
The setting could potentially be exposed globally through a
DeserializationFeature, per property, or both. The resulting input-mapping error should include the duplicate element array index where possible.Usage example
The appropriate configuration API should be agreed with the maintainers first.
Additional context
I observed this with Jackson Databind 2.19.2 and could not find an existing issue or pull request for opt-in duplicate rejection during Set deserialization.
I would be willing to contribute an implementation once the desired API and scope are agreed.