I have Springboot project where i want to documentate my API:
Here the exemple of the Webservice am working on:
@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
My Problem is that Swagger cannot resolve this reference ref = "#/swagger/Planner/semi_planif_200_response.json" i have even tried with the absolute path and it didn't work:
Here is files path:
References are not resolved in compile time instead after running the project the swagger engine will resolve the references as they were static resources within the server:
$ref= resources/swagger/user.json
if we are running our instance in localhost then the resource will be fetched from this url: localhost:8080/resources/swagger/user.json
Tip: make sure that spring resources handler is placing the targeted resources on the specified location!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With