I'm trying to set up swagger-ui based on on existing json config, using 'org.springdoc:springdoc-openapi-ui:1.5.9' dependency (spring boot + gradle)
what I have is:
- custom
openapi.jsonfile in my 'resources/static' folder springdoc.swagger-ui.url=openapi.jsonin my properties
This should be enough according to documentation:
But I've faced a problem trying to open swagger-ui.html, it says "Fetch error
undefined openapi.json":
Looking at browser dev tools and requests, I found following request:
So it uses /swagger-ui/ in path and cannot reach resource. My openapi.json available with simple http://localhost:8080/openapi.json, but w/o prefix.
I've tried to create "swagger-ui" dir under "static", but it did not help, file is still reachable in previous location.
I also tries to setspringdoc.api-docs.path, but it did not help as well, it changes only generated api location.


springdoc.swagger-ui.url=/openapi.json(note the slash/before the file name). Does this help?