Search before asking
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.
Search before asking
Describe the bug
JsonSetter.contentNullsshould 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
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.FAILapplied 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.