Closed ucraida closed 4 years ago
Hi,
By default, you don't need to define the resource handlers, if you want to use springdoc-openapi-ui. There is no relation between springdoc-openapi and springfox.
If you want to migrate to OpenAPI 3:
Please note, that by default you just need to add the right dependency to your project, according to the documentation:
If you don't want to serve the ui from your root path or there is a conflict with an existing configuration, you can just change the following property:
# swagger-ui custom path
springdoc.swagger-ui.path=/you-path/swagger-ui.html
I understand they are different projects, I mentioned springfox because it was working there. However that was my downfall. I just determined that the issue is that swagger-ui.html was an old version cached in chrome from springfox. I plan on opening an issue with springfox, since the way that error is presented prevents the page from being inspected.
Thanks for the quick response and keep up the good work.
Using springdoc-openapi-ui:1.2.0. Adding this to a project which previously had springfox/annotations 1.5.x. Springboot is 2.1.x. The swagger-ui webjars loaded is 3.24.
When attempting to load http://localhost:8080//swagger-ui.html get the common failure seen with swagger-ui:
"Unable to infer base url. This is common when using dynamic servlet registration or when the API is behind an API Gateway. The base url is the root of where all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs then the base url is http://example.org/api/. Please enter the location manually: "
I already have resource handlers in place for webjars:
however - messing with changing the root path & stepping through SwaggerWelcome code I found /swagger-ui/index.htmI. That loaded and eventually I got to this url, which loads fine. http://localhost:8080//swagger-ui/index.html?url=//v3/api-docs&validatorUrl=