Replies: 2 comments 3 replies
-
can you make a test case? what you show is not valid java |
Beta Was this translation helpful? Give feedback.
1 reply
-
That "test" class doesn't test anything but prints out stuff. What is the problem? And no, |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello. I want to ask a question about a situation i run into and i cant find something already explained about this.
Lets consider the following object:
public Parent parent(){ @NonNull public Boolean child; }
In my request class i have this object with @Valid if that is of any importance, as follows:
@Valid public Parent parent
The scenario is the following:
In the request, If i send
"parent":true
its mapped like i would sent
"parent":{ "child": true }
LE:
Target POJO:
Test class created to explain the situation:
The problem comes from obj2, when I pass only a boolean value instead of a key child:boolean value, and the output is the same as obj.
I look for an out of the box solution to stop this and throw an error when this happens.
End of L.E.
My expected behaviour is to fail due to passing a value instead of an object.
Is there any idea if i can stop this value propagation at deserialization with a solution out of the box? (a feature maybe but i cannot find any to do what i need)
I dont know if this is a databind problem or validation problem, still trying to pinpoint the problem.
More details which might be usefull:
Spring, SpringBoot 3.2.1, JacksonDatabind 2.14.1,
Beta Was this translation helpful? Give feedback.
All reactions