0
votes

Trying to generate API documentation for a spring boot application using swagger. Using swagger-maven-plugin to generate yaml documentation from code. After compiling, the generated yaml/json file does not contain any path. However the controller class where the APIs are defined is getting scanned. But none of the APIs defined there are showing up in documentation. However accessing http://localhost:8080/api-docs shows a json and that is listing all the APIs as expected. What could be the issue? I have made sure of the following:

  • controller is annotated with @Api
  • tag value is set to false in pom.xml
  • basepath is the same across pom and controller class

All API paths are of the form http://localhost:8080/{id}/

2

2 Answers

1
votes

Got my problem resolved. The Controller class methods were not declared public and hence was not showing up in swagger.yaml and json files even though the api-docs were listing them.

0
votes

Try mapping your controller into a path. Eg:- @Controller @RequestMapping(value = "/api")

For further clarification you can refer this article: https://www.baeldung.com/spring-controllers