@ApiModel注释不适用于Mono和Flux型反应堆

时间:2019-06-02 18:12:22

标签: swagger spring-webflux

Swagger @ApiModel注释不会为反应堆类型(如Mono或Flux)生成api文档。当我的控制器希望在保存方法中输入Mono时

当我使用Contact联系人而不是Mono contact时,一切正常。

@PostMapping("/save")
@ApiOperation(value = "Save new contact or update existing contact")
public Mono<Object> save(@ApiParam(value = "Contact to be saved") @RequestBody Mono<Contact> contact, @AuthenticationPrincipal Principal principal) {
    return contactService.save(principal, contact);
}



@Data
@Document
@NoArgsConstructor
@ApiModel(value = "Contact api description")
public class Contact {

    @Id
    @ApiModelProperty(value = "Id of contact")
    private String id;  
}

0 个答案:

没有答案