diff --git a/pom.xml b/pom.xml index a56a7bcd..2c49dc99 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ io.federecio dropwizard-swagger - 0.7.1-SNAPSHOT + 0.8.0-SNAPSHOT Dropwizard Swagger support A simple way to document your REST APIs in DropWizard using Swagger @@ -47,11 +47,11 @@ - 0.8.0 + 1.0.0 UTF-8 UTF-8 UTF-8 - 1.7 + 1.8 1.5.1-M2 @@ -176,7 +176,7 @@ io.federecio dropwizard-junit - 0.6 + 0.7 test @@ -277,24 +277,6 @@ - - org.apache.maven.plugins - maven-enforcer-plugin - 1.3.1 - - - enforce - - - - - - - enforce - - - - org.apache.maven.plugins maven-release-plugin diff --git a/src/main/java/io/federecio/dropwizard/swagger/ConfigurationHelper.java b/src/main/java/io/federecio/dropwizard/swagger/ConfigurationHelper.java index c8919957..656baec0 100644 --- a/src/main/java/io/federecio/dropwizard/swagger/ConfigurationHelper.java +++ b/src/main/java/io/federecio/dropwizard/swagger/ConfigurationHelper.java @@ -20,6 +20,8 @@ import io.dropwizard.server.ServerFactory; import io.dropwizard.server.SimpleServerFactory; +import java.util.Optional; + /** * Wrapper around Dropwizard's configuration and the bundle's config that simplifies getting some * information from them. @@ -43,7 +45,7 @@ public String getJerseyRootPath() { return swaggerBundleConfiguration.getUriPrefix(); } - String rootPath; + Optional rootPath; ServerFactory serverFactory = configuration.getServerFactory(); @@ -53,7 +55,9 @@ public String getJerseyRootPath() { rootPath = ((DefaultServerFactory) serverFactory).getJerseyRootPath(); } - return stripUrlSlashes(rootPath); + String rootPathOrNull = rootPath.orElse(null); + + return stripUrlSlashes(rootPathOrNull); } public String getUrlPattern() { diff --git a/src/main/java/io/federecio/dropwizard/swagger/SwaggerBundle.java b/src/main/java/io/federecio/dropwizard/swagger/SwaggerBundle.java index 80e32dc2..2d12d53d 100644 --- a/src/main/java/io/federecio/dropwizard/swagger/SwaggerBundle.java +++ b/src/main/java/io/federecio/dropwizard/swagger/SwaggerBundle.java @@ -16,9 +16,9 @@ package io.federecio.dropwizard.swagger; import com.fasterxml.jackson.annotation.JsonInclude; -import com.google.common.collect.ImmutableMap; import com.wordnik.swagger.jaxrs.config.BeanConfig; import com.wordnik.swagger.jaxrs.listing.ApiListingResource; + import io.dropwizard.Configuration; import io.dropwizard.ConfiguredBundle; import io.dropwizard.assets.AssetsBundle; @@ -26,6 +26,9 @@ import io.dropwizard.setup.Environment; import io.dropwizard.views.ViewBundle; +import java.util.HashMap; +import java.util.Map; + /** * A {@link io.dropwizard.ConfiguredBundle} that provides hassle-free configuration of Swagger and Swagger UI * on top of Dropwizard. @@ -40,8 +43,8 @@ public abstract class SwaggerBundle implements Configur public void initialize(Bootstrap bootstrap) { bootstrap.addBundle(new ViewBundle() { @Override - public ImmutableMap> getViewConfiguration(final Configuration configuration) { - return ImmutableMap.of(); + public Map> getViewConfiguration(final Configuration configuration) { + return new HashMap<>(); } }); }