I am trying to visualize the API definitions from a Multimodule project. First I want to start from simple, and I want to visualize the yaml from the parent module. Then I will add other APIs in my Swagger Controller to call the specific url as is done in the example https://github.com/frehov/micronaut-swagger-server
I have my Swagger Controller and my SwaggerConfiguration with my index.hbs inside resource > views.swagger I took the example from the repo https://github.com/frehov/micronaut-swagger-server
This is my Result:
Instead of something like:
When I compared the two project, somehow my view.swagger package from my target folder gets generated into a different way, compared with the example:
What I am missing? Could you please look at my repo:
https://github.com/amhg/swagger
Thank you
The folder containing the swagger-ui-wrapper (index.hbs) in your project is called 'views.swagger', while the sample has defined 'views/swagger' (so swagger is a folder inside of views). Change that and you get the views/swagger result in your target.
You also need to enable the micronaut handlebars-views (i.e. serving the .hbs files from a controller); add these to the pom.xml of startup (not at the root-pom!):
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-views</artifactId>
</dependency>
<dependency>
<groupId>com.github.jknack</groupId>
<artifactId>handlebars</artifactId>
<version>4.1.0</version>
<scope>runtime</scope>
</dependency>
These will perform the magic of rendering the configuration you return from the controller into an html-page. Depending on where you're going to put the swagger-annotated controllers, you might also want to add
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.version}</version>
<scope>compile</scope>
</dependency>