Should I deal with unexpected json fields in a request? Lets assume that I have got paymentDTO as a input to my controller;
public class PaymentDTO {
private String fromAccountNumber;
private String toAccountNumber;
private BigDecimal amount;
... constructor
... getters
... setters
}
What I expect as a request is:
{
"fromAccountNumber": "1",
"toAccountNumber": "2",
"amount": 50.0
}
What if the user posts a request like below:
{
"fromAccountNumber": "1",
"toAccountNumber": "2",
"amount": 50.0,
"customField1": 100,
"anotherField2: "data"
}
Could it cause any problem in my Spring Boot controller? If so, how should I handle unexpected json request fields?