簡體   English   中英

郵遞員請求不正確 - 字符串錯誤

[英]Postman request is incorrect - Bad String

我的控制器中有這個 dto 請求

@Data
public class OldTransactionFilterDto {
    List<Long> ids;
    List<Integer> depositConfirmationNumbers;
    List<Long> lenderIds;
    LocalDate transactionDateFrom;
    LocalDate transactionDateTo;
    List<TransactionTypes> types;
    Integer offset;
    Integer limit;
}

我在 Postman 中嘗試執行的 json 請求如下所示

{
    "ids" : [1],
    "depositConfirmationNumbers" : [0],
    "lenderIds" : [2],
    "transactionDateFrom" : "2014-01-01",
    "transactionDateTo" : "2019-01-01",
    {"types" : ["Morgage"]},
    "offset" : 1,
    "limit" : 1
}

TransactionTypes 是一個只有一個值的枚舉。 在這個 json 中,郵遞員說我的類型值有錯誤字符串錯誤。

那么 JSON 無效

{
    "ids" : [1],
    "depositConfirmationNumbers" : [0],
    "lenderIds" : [2],
    "transactionDateFrom" : "2014-01-01",
    "transactionDateTo" : "2019-01-01",
    {"types" : ["Morgage"]} --->here!,
    "offset" : 1,
    "limit" : 1
}

必須寫成

{
    "ids" : [1],
    "depositConfirmationNumbers" : [0],
    "lenderIds" : [2],
    "transactionDateFrom" : "2014-01-01",
    "transactionDateTo" : "2019-01-01",
    "types" : ["Morgage"],
    "offset" : 1,
    "limit" : 1
}

使 JSON 正確,您的錯誤將消失!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM