You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We appreciate issues as very valuable contributions, but just to make sure here are things that are important to do before filing an issue:
Only report issues, and ask Usage Questions on Jackson-users list -- ypu are more likely to get help that way
Check to see if this issue has already been reported (quick glance at existing issues): no deep search necessary, just quick sanity check
Include version information for Jackson version you use
(optional but highly recommended) Verify that the problem occurs with the latest patch of same minor version; and even better, if possible, try using the latest stable patch version
assertThrows(MismatchedInputException.class, () -> XML_MAPPER.readValue("<TR></TR>", TestRecordWithoutCreator.class)); will not throw any exception.
[ERROR] com.lingh.RequiredTest.assertRequiredValue -- Time elapsed: 0.276 s <<<FAILURE!
org.opentest4j.AssertionFailedError: Expected com.fasterxml.jackson.databind.exc.MismatchedInputException to be thrown, but nothing was thrown.
at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:152)
at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:73)
at org.junit.jupiter.api.AssertThrows.assertThrows(AssertThrows.java:35)
at org.junit.jupiter.api.Assertions.assertThrows(Assertions.java:3115)
at com.lingh.RequiredTest.assertRequiredValue(RequiredTest.java:21)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Did I misunderstand something while reading the documentation?
The text was updated successfully, but these errors were encountered:
Correct: @JsonProperty(required=true) is only enforced if and when properties are passed via Creator method (constructor or static factory method). It would be nice to support if for Setter/Field injected properties too; it is one of "most-wanted" issues:
We appreciate issues as very valuable contributions, but just to make sure here are things that are important to do before filing an issue:
TL;
While investigating Removes use of JAXB API via jackson-dataformat-xml apache/shardingsphere#29384 , I noticed that without setting
@JsonCreator
for the POJO, therequired
attribute in@JsonProperty
is not checked.I created a minimal unit test at https://github.com/linghengqian/jackson-xml-required-check-test . The core code looks like this.
assertThrows(MismatchedInputException.class, () -> XML_MAPPER.readValue("<TR></TR>", TestRecordWithoutCreator.class));
will not throw any exception.The text was updated successfully, but these errors were encountered: