Class OpenApiRoutesConfigurer<A extends ExchangeContext>
- Type Parameters:
A
- the exchange context type
- All Implemented Interfaces:
WebRoutesConfigurer<A>
Web routes configurer used to configure routes exposing generated Open API specifications.
This configurer defines the following routes:
/open-api
- Returns the JSON list the Open API specifications
- If Swagger UI is enabled and request is made with
accept: text/html
header, a Swagger UI presenting all the specifications is returned /open-api/{moduleName}
- Returns the YAML Open API specification of the specified module
- If Swagger UI is enabled and request is made with
accept: text/html
header, a Swagger UI presenting the module's specification is returned
Note that Swagger UI requires WebJars support and the swagger-ui
WebJar.
- Since:
- 1.3
- Author:
- Jeremy Kuhn
- See Also:
-
Constructor Summary
ConstructorDescriptionOpenApiRoutesConfigurer
(ResourceService resourceService) Creates an Open API web routes configurer with Swagger supprt and the specified resource service.OpenApiRoutesConfigurer
(ResourceService resourceService, boolean enableSwagger) Creates an Open API web routes configurer with the specified resource service. -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(WebRoutable<A, ?> routes) Configures routes.Returns the Open API specification for the specified module usually in YAML format.getSpecSwaggerUI
(String moduleName) Returns the Swagger UI loading HTML for the Open API specification of the specified modulelistSpec()
Returns a JSON list including all available Open API specifications.Returns the Swagger UI loading HTML for all available Open API specifications.
-
Constructor Details
-
OpenApiRoutesConfigurer
Creates an Open API web routes configurer with Swagger supprt and the specified resource service.
- Parameters:
resourceService
- the resource service
-
OpenApiRoutesConfigurer
Creates an Open API web routes configurer with the specified resource service.
- Parameters:
resourceService
- the resource serviceenableSwagger
- true to enable Swagger UI routes, false otherwise
-
-
Method Details
-
configure
Description copied from interface:WebRoutesConfigurer
Configures routes.
- Specified by:
configure
in interfaceWebRoutesConfigurer<A extends ExchangeContext>
- Parameters:
routes
- the web routable to configure
-
listSpec
Returns a JSON list including all available Open API specifications.
- Returns:
- a raw list of specifications
-
listSpecSwaggerUI
Returns the Swagger UI loading HTML for all available Open API specifications.
- Returns:
- a raw Swagger UI loader
-
getSpec
Returns the Open API specification for the specified module usually in YAML format.
- Parameters:
moduleName
- the module name- Returns:
- a raw Open API specification
- Throws:
NotFoundException
- if there's no specification for the specified module
-
getSpecSwaggerUI
Returns the Swagger UI loading HTML for the Open API specification of the specified module
- Parameters:
moduleName
- the module name- Returns:
- a raw Swagger UI loader
- Throws:
NotFoundException
- if there's no specification for the specified module
-