I'm having a bit of trouble making Swagger display API docs using Restlet. What Swagger shows is just these stuff:
And checking the api-docs it only shows this:
I wonder what is wrong with my code:
public class MyApplication extends SwaggerApplication {
private static final String ROOT_URI = "/";
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach(ROOT_URI, RootServerResource.class);
router.attach(ROOT_URI + "ping", PingServerResource.class);
router.attach(ROOT_URI + "ping/", PingServerResource.class);
// Some code omitted for simplicity
return router;
}
}
Swagger needs to find your API operations. I'm not sure about Restlet, in Jersey you annotate your REST resource classes with
@Api
and your methods with@ApiOperation
. Read more here in the swagger docs.You could have a look at this article:
Both Swagger1 and 2 are supported by the Swagger extension of Restlet:
Swagger v1
Swagger v2
The solution is to add this code:
And point the Swagger UI to
/swagger.json