Swagger 2.0 support in Grails 3+ (3.0.11) not working
<p>I am running Grails 3.0.11 and want to create Swagger-documentation for my REST endpoints. I added the <a href="https://github.com/rahulsom/swaggydoc" rel="nofollow">SwaggyDoc</a>-<a href="http://grails.org/plugin/swaggydoc" rel="nofollow">plugin</a> to the dependencies in my build.gradle script by adding:</p>

<pre><code>compile "org.grails.plugins:swaggydoc:0.26.0".
</code></pre>

<p>In IntelliJ I see the Swaggydoc-dependency added to my list of libraries.</p>

<p>After starting my Grails-application via the grails run-app command and opening my application by entering <a href="http://localhost:8080/api/" rel="nofollow">http://localhost:8080/api/</a> I get an 404 error telling the page does not exist.</p>

<p>Do I need to configure something more or to run something special to generate documentation? I already tried to open a ticket in the Git-project and contacting the author with no succes.</p>

<p><strong>Update1</strong>: there seems to be a Grails 3-plugin (found at Versioneye?) which I added:</p>

<pre><code>compile "org.grails.plugins:swaggydoc-grails3:0.26.0"
</code></pre>

<p>It does work half, by default some sort of Pet-demo is visible and it is failing on constraints in a domain and enums. Doesn't seem to work very well actually.</p>

<p><strong>Update2</strong>: As pointed out by Dilip Krishnan I tried to use SpringFox, first I added the dependencies to my Gradle build file:</p>

<pre><code>compile("io.springfox:springfox-swagger2:2.3.1")
compile("io.springfox:springfox-swagger-ui:2.3.1")
</code></pre>

<p>Then I added a new class called <em>ApiDocumentationConfiguration</em> with the following code:</p>

<pre><code> @Configuration
 @EnableSwagger2
 public class ApiDocumentationConfiguration {
 @Bean
 public Docket documentation() { 
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(PathSelectors.any())
            .build();
 }

 @Bean
 public UiConfiguration uiConfig() {
    return UiConfiguration.DEFAULT;
 }

 private ApiInfo metadata() {
    return new ApiInfoBuilder()
           .title("My awesome API")
            .description("Some description")
            .version("1.0")
            .contact("my-email@domain.org")
            .build();
 }
}
</code></pre>

<p>My Grails resources file contains the following code:</p>

<pre><code>beans = {
    apiDocumentationConfiguration(ApiDocumentationConfiguration)
}
</code></pre>

<p>Last step was starting the application and trying to load the end point which shows the Swagger front end:</p>

<pre><code>http://localhost:8080/swagger-ui.html
</code></pre>

<p>It behind the scenes tries to load an other end point (containing the JSON I guess?) which loads </p>

<pre><code>http://localhost:8080/v2/api-docs
</code></pre>

<p>This does show JSON data and I get end points for things like a basic error controller, health mvc, metrics mvc et cetera. But not my own annotated user controller which is annotated like follows:</p>

<pre><code>@Api(value = "users", description = "Endpoint for user management")
class UserController { 

    // GET all users
    @ApiOperation(value = "doStuff", nickname = "doStuff", response = User.class)
    def index() {
        respond User.list()
    }
}
</code></pre>

<p>Seems I am almost there, but still missing something, is my annotation wrong or doesn't it scan my controllers?</p>

<p><strong>Update3</strong>: in contact with one of the authors of SpringFox (Dilip Krishnan) to add support for Grails 3+ to SpringFox, see <a href="https://github.com/springfox/springfox/issues/1169" rel="nofollow">ticket</a>. The reason it doesn't currently work is because SpringFox looks at MVC annotation, an adapter needs to be written to retrieve the endpoints from the controllers in Grails.</p>