Reputation: 894
I have this dto for request in my controller
@Data
public class OldTransactionFilterDto {
List<Long> ids;
List<Integer> depositConfirmationNumbers;
List<Long> lenderIds;
LocalDate transactionDateFrom;
LocalDate transactionDateTo;
List<TransactionTypes> types;
Integer offset;
Integer limit;
}
The json request I am trying to do in Postman looks like this
{
"ids" : [1],
"depositConfirmationNumbers" : [0],
"lenderIds" : [2],
"transactionDateFrom" : "2014-01-01",
"transactionDateTo" : "2019-01-01",
{"types" : ["Morgage"]},
"offset" : 1,
"limit" : 1
}
The TransactionTypes is enum with only one value. In this json Postman says I have error Bad String on my Types value.
Upvotes: 0
Views: 373
Reputation: 8868
Well the JSON is invalid
{
"ids" : [1],
"depositConfirmationNumbers" : [0],
"lenderIds" : [2],
"transactionDateFrom" : "2014-01-01",
"transactionDateTo" : "2019-01-01",
{"types" : ["Morgage"]} --->here!,
"offset" : 1,
"limit" : 1
}
It must be written as
{
"ids" : [1],
"depositConfirmationNumbers" : [0],
"lenderIds" : [2],
"transactionDateFrom" : "2014-01-01",
"transactionDateTo" : "2019-01-01",
"types" : ["Morgage"],
"offset" : 1,
"limit" : 1
}
Make the JSON proper, your error will be gone!
Upvotes: 1