Swagger 中出现错误消息“未提供必填字段”

问题描述 投票:0回答:1
public ResponseEntity<Document> fetchRep(
    @Parameter(name = "fromDate", description = "${AbcController.fromDate.ApiParam.value}",
      required = true,
      example = "2023-01-11", schema = @Schema(type = "String"),
      allowEmptyValue = false) @RequestHeader(value = "fromDate", required = true) String fromDate,
    @Parameter(name = "toDate", description = "${AbcController.toDate.ApiParam.value}",
      required = true,
      example = "2023-01-11",
      schema = @Schema(type = "String"), allowEmptyValue = false) @RequestHeader(value = "toDate", required = true) String toDate

image link

yaml 文档 -

AbcController:
 fromDate:
   ApiParam:
    value: 'Holds the date from which the report data is generated. [yyyy-mm-dd]'
 toDate:
   ApiParam:
    value: 'Holds the date till which the report data is generated [yyyy-mm-dd]'

您能告诉我为什么会收到此验证错误吗?

java spring-boot swagger-ui
1个回答
0
投票

改变

@Schema(type = "String")

@Schema(type = "string")

注意“string”中的小写“s”。

© www.soinside.com 2019 - 2024. All rights reserved.