For Dropwizard 0.7.0 I configure swagger like this:
void configureSwagger(Environment environment) {
environment.jersey().register(new ApiListingResourceJSON());
environment.jersey().register(new ApiDeclarationProvider());
environment.jersey().register(new ResourceListingProvider());
ScannerFactory.setScanner(new DefaultJaxrsScanner());
ClassReaders.setReader(new DefaultJaxrsApiReader());
SwaggerConfig config = ConfigFactory.config();
config.setApiVersion(API_VERSION);
config.setBasePath(".." + environment.getApplicationContext().getContextPath());
}
EDIT
To run Swagger UI with Dropwizard clone the repo and copy the dist
directory into src/main/resources/swagger/
(customizing as necessary). Then add the asset bundle like this:
@Override
public void initialize(Bootstrap<ApplicationConfiguration> bootstrap) {
bootstrap.addBundle(new AssetsBundle("/swagger/", "/docs", "index.html"));
}