Search code examples
micronaut

Micronaut Swagger Groovy not generating openapi yaml file


I am using Micronaut 1.0.3 with Groovy language. based on this document https://docs.micronaut.io/latest/guide/index.html#openapi created groovy code.

import io.micronaut.runtime.Micronaut
import groovy.transform.CompileStatic
import io.swagger.v3.oas.annotations.*;
import io.swagger.v3.oas.annotations.info.*;

@OpenAPIDefinition(
        info = @Info(
                title = "Hello World",
                version = "0.0",
                description = "My API",
                license = @License(name = "Apache 2.0", url = "http://foo.bar"),
                contact = @Contact(url = "http://gigantic-server.com", name = "Fred", email = "Fred@gigagantic-server.com")
        )
)

@CompileStatic
class Application {
    static void main(String[] args) {
        Micronaut.run(Application)
    }
}

When I run the application It not generating the META-INF/swagger/hello-world-0.0.yml file.

Any tips to troubleshoot this issue?

Thanks SR


Solution

  • Below dependencies in build.gradle worked for me

    annotationProcessor "io.micronaut.configuration:micronaut-openapi"
    compile "io.swagger.core.v3:swagger-annotations"
    compileOnly "io.micronaut.configuration:micronaut-openapi"
    

    You can also try, mn create-app hello-world --features swagger-groovy