-
Notifications
You must be signed in to change notification settings - Fork 38.5k
@JsonIgnoreProperties(ignoreUnknown=false) is not working in Spring 4.2.8 and upper version [SPR-15008] #19575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Masbha Uddin Ahmed commented Team, |
Sébastien Deleuze commented We deliberately changed Jackson default configuration to You can easily bring back the old behavior using @Bean
public Jackson2ObjectMapperBuilder mapperBuilder() {
return new Jackson2ObjectMapperBuilder().failOnUnknownProperties(true);
} Based on my tests, Any thoughts? |
Sébastien Deleuze commented Resolving this issue as incomplete since no feedback has been provided for a long time and if there is an issue, it seems to be more on Jackson side. |
This comment has been minimized.
This comment has been minimized.
The reason: FasterXML/jackson-databind#3067 If |
Masbha Uddin Ahmed opened SPR-15008 and commented
Recently we have increased our Spring version from 4.0.4 to 4.2.8 and this we have done in order to support MongoDB upgrade to 3.2.x version. After upgrading to latest spring version we have noticed, in all Rest Api's if we pass some invalid inputs along with valid input fields, requests are still getting through and getting 200 response code even though it has invalid fields.
This was working fine in previous Spring version of 4.0.4, where it will throw malformed syntax with 400 response code.
Somehow with recent upgrades of Spring, this feature is not working anymore. We have tried different Spring version in 4.2.x and 4.3.x series, still it is not working as expected.
Please find the example below for understanding on this issue. We need a solution or workaround on this issue as we couldn't figure out what is causing the issue.
Also could you confirm is this a bug in Spring or are we missing anything with Spring upgrade.
@JsonIgnoreProperties
(ignoreUnknown=false) is not working with spring 4.2.0 and upper version of spring. But it is working with 4.0.4 and 4.0.1 .Spring and Jackson dependency we have used,
If I send json request with invalid fields then it is accepting as a valid request. But it should give the bad request response.
For example:
If I have class
public class Student {
private String id;
private String name;
}
If send valid corresponding json request it should be like
{
"id": "123",
"name": "test"
}
But even if I send json request with invalid fields like below it is still accepting.
{
"id": "123",
"name": "test",
"anyinvalidkey": "test"
}
Affects: 4.2.4, 4.2.8
Issue Links:
The text was updated successfully, but these errors were encountered: