Search in sources :

Example 1 with SwaggerResource

use of gov.ca.cwds.rest.resources.SwaggerResource in project api-core by ca-cwds.

the class BaseApiApplication method configureSwagger.

private void configureSwagger(final T apiConfiguration, final Environment environment) {
    BeanConfig config = new BeanConfig();
    SwaggerConfiguration swaggerConfiguration = apiConfiguration.getSwaggerConfiguration();
    config.setTitle(swaggerConfiguration.getTitle());
    config.setDescription(swaggerConfiguration.getDescription());
    config.setResourcePackage(swaggerConfiguration.getResourcePackage());
    config.setScan(true);
    new AssetsBundle(swaggerConfiguration.getAssetsPath(), swaggerConfiguration.getAssetsPath(), null, "swagger").run(environment);
    LOGGER.info("Registering ApiListingResource");
    environment.jersey().register(new ApiListingResource());
    LOGGER.info("Registering SwaggerResource");
    SwaggerResource swaggerResource = new SwaggerResource(swaggerConfiguration);
    environment.jersey().register(swaggerResource);
    if (swaggerConfiguration.isShowSwagger()) {
        TokenResource tokenResource = new TokenResource(swaggerConfiguration);
        environment.jersey().register(tokenResource);
    }
}
Also used : BeanConfig(io.swagger.jaxrs.config.BeanConfig) SwaggerResource(gov.ca.cwds.rest.resources.SwaggerResource) TokenResource(gov.ca.cwds.rest.resources.TokenResource) AssetsBundle(io.dropwizard.assets.AssetsBundle) ApiListingResource(io.swagger.jaxrs.listing.ApiListingResource)

Aggregations

SwaggerResource (gov.ca.cwds.rest.resources.SwaggerResource)1 TokenResource (gov.ca.cwds.rest.resources.TokenResource)1 AssetsBundle (io.dropwizard.assets.AssetsBundle)1 BeanConfig (io.swagger.jaxrs.config.BeanConfig)1 ApiListingResource (io.swagger.jaxrs.listing.ApiListingResource)1