我在一个项目中删除了一个古老的傲慢,并在正式文档之后添加了springdoc。
我应该做错事的,但我不知道是什么。不知何故,当我试图执行一个调用时,URL中的参数不会被替换:

正如你在图像中所看到的,卷曲在结尾处附加一个{id},而不是13。如果我自己用数字13来尝试这个卷曲,它工作得很好。
这是这个特定调用的代码:
@Operation(summary = "Gets a client.")
@ApiResponses({ @ApiResponse(responseCode = "200", description = "Ok"),
@ApiResponse(responseCode = "404", description = "Not found") })
@GetMapping(path = "/{id}")
public ResponseEntity get(@PathVariable @Parameter(name = "ID of client") final Long id) {
final ClientDTO response = clientService.get(id);
return ResponseEntity.ok(response);
}我使用的是springdoc 2.7.3和springdoc 1.6.11
发布于 2022-09-21 11:01:19
我发现了问题。
我是从满不在乎的芒果工厂迁移过来的,而我跟随的向导是错误的。在“参数”中,它应该是“描述”而不是“名称”。
swagger没有帮助查找这个错误,因为没有描述,所以它使用了名称。但是,由于我在名义上写描述,似乎一切都是正确的(在描述下,我看到了我期望的字符串)。
https://stackoverflow.com/questions/73788563
复制相似问题