У меня есть следующий контроллер, который я пытаюсь проверить с Почтальоном
public ResponseEntity<List<OldTransactionEntity>> createTransaction(@Valid @RequestBody List<OldTransactionNewDto> newDtos) {
return ResponseEntity.ok(transactionService.createTransactions(newDtos));
}
OldTransactionNewDto выглядит так:
@Data
public class OldTransactionNewDto {
@Min(0)
private BigDecimal amount;
private Integer depositConfirmationNumber;
@NotNull
private LocalDate transactionDate;
private TransactionTypes type;//TODO: Swap with enum? Now values are {1,2}
@NotNull
private Long lenderId;//TODO: Make db check with annotation or not?
private Integer associatedAccountNumber;
private Integer fileRequestId;//TODO: Remove?
private String transferNotes;
private LocalDateTime confirmationTime;
private BigDecimal liquefied;
private Boolean isNotifiedNotInvested;
private String giTransactionId; //TODO: Remove?
private Long transferId; //TODO: Remove?
private Long originalTransactionRequestId; //TODO: Remove?
private Boolean isInitialApproved; //TODO: Remove?
private BankAccountNewDto parentBankAccount;
private BankAccountNewDto childBankAccount;
}
Запрос json Я создаю в Почтальоне is
{
"amount" : 234,
"depositConfirmationNumber" : 23,
"transactionDate" : "2020-03-18",
"type" : "DEPOSIT",
"lenderId" : 2332,
"associatedAccountNumber" : 32425,
"fileRequestId" : 321,
"transferNotes" : "note",
"confirmationTime" : "2020-03-18",
"liquefied" : 23412,
"isNotifiedNotInvested" : false,
"giTransactionId" : "245",
"transferId" : 324,
"originalTransactionRequestId" : 23,
"isInitialApproved" : true,
"parentBankAccount" : [
{
"userId" : 1,
"bankAccountNumber" : 2,
"bankNumber" : 123,
"bankBranchNumber" : 2341,
"bankDetails" : "details",
"freeText" : "Free text"
}],
"childBankAccount" : [
{
"userId" : 1,
"bankAccountNumber" : 2,
"bankNumber" : 123,
"bankBranchNumber" : 2341,
"bankDetails" : "details",
"freeText" : "Free text"
}]
}
Я получаю MismatchInputException JSON Ошибка разбора: Невозможно десериализовать экземпляр java.util.ArrayList
, так что это может быть потому, что мне нужно предоставить Список OldTransactioNewDtos