Micronaut Swagger API
This project provides out-of-box user-friendly integration for merging Swaggers (OpenAPI also), exposing Swagger & Swagger-UI HTTP endpoints.
Dependency
🚀
Library ships ready for Micronaut 2.
Gradle
dependencies {
compile 'com.github.goodforgod:micronaut-swagger-api:1.0.0'
}
Maven
<dependency>
<groupId>com.github.goodforgod</groupId>
<artifactId>micronaut-swagger-api</artifactId>
<version>1.0.0</version>
</dependency>
Endpoints
Library provide exposure for statis resources:
- /swagger - Endpoint for exposing merged Swagger (if there are any to merge) as static resource.
- /swagger-ui - Endpoint for exposing Swagger UI page resource.
- /rapidoc - Endpoint for exposing Rapidoc page resource.
Swagger
Library only exposes Swagger files, not generating them, so you need to generate Swagger for your service first and library will help with its exposure.
By adding to your Gradle dependencies:
annotationProcessor("io.micronaut.configuration:micronaut-openapi:2.1.0")
implementation("io.swagger.core.v3:swagger-annotations")
Check Micronaut official documentation for more information.
Configuration
Library provides out-of-box /swagger (merge enabled), /swagger-ui, /rapidoc endpoints.
There is ability to easily merge multiple Swagger files via simple configuration property.
Other settings are available to configure for service, however most of them are default for user-friendly bootstrap just by adding library as dependency.
swagger:
enabled: true // enalbed Swagger YAML exposing via HTTP endpoint (default - true)
merge: true // enabled merging swaggers if multiple found (default - true)
exclude: // Exclude some swagger files
- swagger-1.yml
- swagger-2.yml
path: /swagger // path for Swagger HTTP endpoint (default - /swagger)
ui:
path: /swagger-ui // path for Swagger-UI HTTP endpoint (default - /swagger-ui)
enalbed: true // enalbed Swagger-UI exposing via HTTP endpoint (default - true)
rapidoc:
path: /rapidoc // path for Rapidoc HTTP endpoint (default - /rapidoc)
enalbed: true // enalbed Rapidoc exposing via HTTP endpoint (default - false)
Version History
1.0.0 - Initial version, with /swagger, /swagger-ui, /rapidoc HTTP endpoint support.
License
This project licensed under the Apache License 2.0 - see the LICENSE file for details.