0

I have a Open API 3.0 swagger doc. I am using Spring's OpenAPI autogen plugin to generate the API controllers and Delegates.

There is a HomeController that gets autogenerated.

/**
 * Home redirection to OpenAPI api documentation
 */
@Controller
public class HomeController {
    @RequestMapping("/")
    public String index() {
        return "redirect:swagger-ui.html";
    }
}

Is there a way I can change base path in my swagger documentation to create a HomeController similar to this:

@Controller
public class HomeController {
    @RequestMapping("/")
    public String index() {
        return "redirect:/rest/swagger-ui.html";
    }
}

My stack:

  1. Spring Boot: 2.1.1
  2. Openapi: 3.0.0
Ayman Arif
  • 1,456
  • 3
  • 16
  • 40

1 Answers1

1

Look at these:

My raw solution:

server.servlet.context-path=/rest

but in this way all the paths start whit /rest

EDIT

can this be fine?

@Controller
public class HomeController {
    @RequestMapping("/rest")
    public String index() {
        return "redirect:/swagger-ui.html";
    }
}