7 Swagger Integration
Version: 3.1.0
7 Swagger Integration
With the jersey1 implementation of the JAX-RS plugin, Swagger 2.0 support is built-in, although it is disabled by default.When Swagger is enabled, the/swagger.json
endpoint is exposed containing the
details about the application's API services, assuming the resources are
annotated with the proper
Swagger annotations.Configuration
All of the Swagger configuration options are set under the pathorg.grails.jaxrs.swagger
. The following options are available.Configuration Property | Required | Description | Type | Default |
---|---|---|---|---|
enabled | ![]() | If true, /swagger.json will be exposed with details regarding the API service. | Boolean | false |
beanConfigClassName | The fully qualified class name of a custom instance of BeanConfig used to provide information about the API service. This is useful when applications need to provide additional information, such as security requirements. | String | ||
resourcePackage | ![]() | The package that swagger should scan for JAX-RS resources. Multiple packages may be provided as a comma-separated list. | String | |
version | The API version number. | String | 1 | |
title | The title of the API service. If this is not set, the application name is used. | String | Application name. | |
description | The description of the API service. | String | ||
contact | Contact information. | String | ||
license | License name. | String | ||
licenseUrl | URL to information about the license. | String | ||
scan | Whether Swagger should scan for resources. | Boolean | true | |
baseUrl | The base URL to the API service. This is useful when the application lives behind a load balancer. | String | The application's discovered base URL. |
Swagger UI
When thejaxrs-swagger-ui
plugin is included in an application, the Swagger
UI is exposed with the path /showRestApi
. The UI has been modified only in
that it is hardcoded to query the application itself for the swagger.json
information.