-
Notifications
You must be signed in to change notification settings - Fork 98
Swagger Integration
The OSGi-JAX-RS Connector provides swagger integration in a separate bundle called com.eclipsesource.jaxrsprovider.swagger
. This bundle just needs to be started in the same OSGi instance your JAX-RS reosurces run in and swagger is ready to serve.
The com.eclipsesource.jaxrsprovider.swagger
depends on Swagger. Swagger itself has a lot of dependencies which makes it no fun when you have to manage the dependencies manually. For this reason the OSGi-JAX-RS connector project provides a rebundled version of Swagger that is self contained called com.eclipsesource.jaxrs.swagger-all
. Please note: The provider bundle only uses package imports. So, it's up to you to use the all bundle or the original Swagger artifacts.
Swagger registers a resource on the path /swagger.json
and /swagger.yaml
. Please note the this registration is relative to your configured root path. So, if you are using /services
as the root path your swagger.json
will be available on /services/swagger.json
. See the swagger.io website and documentation for more information about Swagger.
The Swagger integration provides the ability to configure Swagger using the OSGi configuration admin. You can configure the service with pid com.eclipsesource.jaxrs.swagger.config
using the following properties:
swagger.basePath
swagger.host
swagger.filterClass
swagger.info.title
swagger.info.description
swagger.info.version
swagger.info.termsOfService
swagger.info.contact.name
swagger.info.contact.url
swagger.info.contact.email
swagger.info.license.name
swagger.info.license.url
Please see the Swagger specification for the meaning of these properties.
An example is located in examples/com.eclipsesource.jaxrs.connector.example.swagger
which registers just one service and uses the OSGi config admin to configure swagger. The image below shows the example used together with Swagger UI.