-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
to-evaluateIssue that has been received but not yet evaluatedIssue that has been received but not yet evaluated
Description
Search before asking
- I searched in the issues and found nothing similar.
Describe the bug
JsonSetter.contentNulls should fundamentally only apply to the explicitly provided parameters.
That is, if this specification is applied to a parameter like List<List<String>>, [null] should be rejected, but [[null]] should be allowed.
However, in practice, [[null]] is rejected.
Version Information
3.1.0
Reproduction
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class Kotlin1064Test {
record Dst(
@JsonSetter(contentNulls = Nulls.FAIL)
List<List<String>> foo
) {}
@Test
public void test() {
var mapper = JsonMapper.builder().build();
assertThrows(InvalidNullException.class, () -> mapper.readValue("{\"foo\":[null]}", Dst.class));
// fails
assertDoesNotThrow(() -> mapper.readValue("{\"foo\":[[null]]}", Dst.class));
}
}Expected behavior
No response
Additional context
This relates to the following issues.
FasterXML/jackson-module-kotlin#1064
While it's hard to say what behavior is ideal, having Nulls.FAIL applied to the entire nested structure feels a bit cumbersome to handle.
Also, I don't have a specific design in mind yet, but I feel that fundamentally, we might need to change the structure of JsonSetter.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
to-evaluateIssue that has been received but not yet evaluatedIssue that has been received but not yet evaluated