Swagger interface has wrong base path
I am using grape gem and SwaggerUI standalone installation . My API documentation is at http://example.com/api/v1/docs/ . SwaggerUI discovers all resources but sends all requests to http://example.com/v1/foo (missing "api /" from url). Why is this?
+3
source to share
2 answers
Had the same problem using maven with spring-boot ans swagger-ui 2.4.0. A possible incompatibility with other packages such as Thymelear regarding resource URLs could be causing this problem.
As a workaround, I could overcome the broken links by reassigning the url like this:
@Configuration
public class CustomResourceMapping extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addRedirectViewController(
"/configuration/ui",
"/swagger-resources/configuration/ui");
registry.addRedirectViewController(
"/configuration/security",
"/swagger-resources/configuration/security");
}
}
0
source to share