The class SwaggerApplication
only supports Swagger 1.2. If you want to use Swagger 2.0, you must attach manually the corresponding restlet to generate the content based on the class Swagger2SpecificationRestlet
as described below:
public Restlet createInboundRoot() {
Router router = new Router(getContext());
// Configuring Swagger 2 support
Swagger2SpecificationRestlet swagger2SpecificationRestlet
= new Swagger2SpecificationRestlet(this);
swagger2SpecificationRestlet.setBasePath(
"http://myapp.com/api/v1");
swagger2SpecificationRestlet.attach(router);
return router;
}
With such configuration, the associated resource to get the Swagger content is attached on the path /swagger.json
. You can notice that you can specify your own path with the method Swagger2SpecificationRestlet#attach(Router, String)
.
Hope it helps you,
Thierry