基本上,我感兴趣的是,Swagger在swagger中显示的唯一模型是否是用于RestController方法的模型。它检测到我填充了@RequestBody的DTO,但它没有检测用户模型,即使使用ApiModel注释也是如此。如何在不做假人控制器的情况下绕过这个问题?
例如:
@PostMapping("/signin")
@ApiOperation
public String login(
@ApiParam(value = "The login credentials DTO (username and password)", required = true)
@RequestBody
@Valid LoginCredentialsDTO loginCredentialsDTO) {
return userService.login(loginCredentialsDTO);
}它检测"LoginCredentialsDTO“模型,因为它在这里使用在控制器方法中。
因为我只在控制器中使用DTO,所以它没有检测到我的主要模型(用户)。我不想为了Swagger能够检测到我所有的模型而做一个虚拟的方法。
发布于 2019-12-19 11:18:25
Swagger描述api的外部接口。当您的用户模型不在外部使用时,是不可见的。另见swagger.io/docs/specification/2-0/basic-structure
https://stackoverflow.com/questions/59406099
复制相似问题