我有Springboot项目,我想在这里记录我的API:
这里,Webservice的例子是:
@ApiResponses(
value = {
@ApiResponse(responseCode = "200", content = @Content(
mediaType = "*/*",
schema = @Schema(implementation = Object.class),
examples = {
@ExampleObject(name = "boo",
summary = "example of boo",
ref = "#/swagger/Planner/semi_planif_200_response.json")
}
))
}
)
@PostMapping(value = "/startSemiPlanification", produces = "application/json")
private ResponseEntity<Object> startSemiPlanner( @RequestBody PlanificationDto planificationData,
@RequestParam(name = "groupByUserCode", required = false) Optional<Boolean> groupByUserCode,
@RequestParam(name = "range", defaultValue = "18") Integer range
我的问题是Swagger无法解决这个引用,ref =,我甚至尝试过使用绝对路径,但它没有工作:
以下是文件路径:
发布于 2020-03-19 22:45:17
引用不是在编译时解析的,而是在运行项目之后,swagger引擎将解析这些引用,因为它们是服务器中的静态资源:
$ref= resources/swagger/user.json
如果我们在localhost中运行我们的实例,那么资源将从这个url:localhost:8080/resources/swagger/user.json
中获取。
提示:确保spring资源处理程序将目标资源放置在指定位置!
https://stackoverflow.com/questions/60719210
复制相似问题