【发布时间】:2021-09-14 14:16:02
【问题描述】:
我面临的问题是,如果我用 swagger 的 @ApiParam 注释标记方法签名中的任何参数,那么我在地址 /swagger-ui.html 上看不到此方法
例子:
@GetMapping
@ApiOperation(value = "Get magazines by type")
public List<Magazine> getMagazines(@RequestParam @NotNull String type) {
List<Magazine> response = service.getMagazines(type);
return response;
}
在这种情况下,如果我去 localhost:8080/swagger-ui.html 我会在控制器中看到这个方法
但是如果该方法有@ApiParam注解,它就不会在swagger上显示
@GetMapping
@ApiOperation(value = "Get magazines by type")
public List<Magazine> getMagazines(@ApiParam(defaultValue = "TEST") @RequestParam @NotNull String type) {
List<Magazine> response = service.getMagazines(type);
return response;
}
任何想法为什么会发生?
【问题讨论】: