【发布时间】:2021-04-11 20:30:52
【问题描述】:
我正在努力正确描述 requestBody。 我有这个 Dto 作为请求正文:
public @Data class ContactDto {
@Parameter(description = "Mailadress required if messageType is MAIL")
private String mailAddress;
@Parameter(description = "Phonenumber required if messageType is not MAIL", example =
"0041791234567")
private String phoneNumber;
@Parameter(description = "Message type which will be used to inform the user", examples = {
@ExampleObject(name = "SMS", value = "SMS"),
@ExampleObject(name = "MAIL", value = "MAIL")
})
private MessageType messageType;
}
这在控制器中:
@PostMapping(consumes = "application/json")
public ResponseEntity<Object> createWichtel(@RequestBody() final WichtelDetailsDto wichtelDetailsDto)
{
return new ResponseEntity<>(HttpStatus.CREATED);
}
我正在使用 Spring 和 springdoc-openapi-ui
但是当我打开 swagger-ui 时,上面的描述没有显示。 这里有什么错误?
【问题讨论】:
标签: spring annotations swagger