Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump version of dropwizard and swagger #74

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dropwizard-swagger
==================

a Dropwizard bundle that serves Swagger UI static content and loads Swagger endpoints. Swagger UI static content is taken from https://github.com/wordnik/swagger-ui
a Dropwizard bundle that serves Swagger UI static content and loads Swagger endpoints. Swagger UI static content is taken from https://github.com/swagger-api/swagger-ui

Current version has been tested with Dropwizard 0.8.0 and Swagger 1.5.1-M2 which supports Swagger 2 spec!
Current version has been tested with Dropwizard 0.8.0 and Swagger 1.5.4 which supports Swagger 2 spec!

Note: if you come from previous versions there have been some changes in the way the bundle is configured, see details below.

Expand All @@ -21,6 +21,7 @@ dropwizard-swagger|Dropwizard|Swagger API|Swagger UI
0.5.x | 0.7.x | 1.3.12 | v2.1.4-M1
0.6.x | 0.8.0 | 1.3.12 | v2.1.4-M1
0.7.x | 0.8.0 | 1.5.1-M2| v2.1.4-M1
0.8.x | 0.8.4 | 1.5.4 | v2.1.4-M1

How to use it
-------------
Expand Down
22 changes: 16 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>io.federecio</groupId>
<artifactId>dropwizard-swagger</artifactId>
<version>0.7.1-SNAPSHOT</version>
<version>0.8.0-SNAPSHOT</version>

<name>Dropwizard Swagger support</name>
<description>A simple way to document your REST APIs in DropWizard using Swagger</description>
Expand Down Expand Up @@ -47,12 +47,12 @@
</scm>

<properties>
<dropwizard.version>0.8.0</dropwizard.version>
<dropwizard.version>0.8.4</dropwizard.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<file.encoding>UTF-8</file.encoding>
<jdk.version>1.7</jdk.version>
<swagger.version>1.5.1-M2</swagger.version>
<swagger.version>1.5.4</swagger.version>
</properties>

<dependencies>
Expand All @@ -77,7 +77,7 @@
<version>${dropwizard.version}</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>${swagger.version}</version>
<exclusions>
Expand Down Expand Up @@ -127,13 +127,17 @@
</exclusion>

<exclusion>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -178,6 +182,12 @@
<artifactId>dropwizard-junit</artifactId>
<version>0.6</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.client-drivers</groupId>
Expand Down
12 changes: 3 additions & 9 deletions src/main/java/io/federecio/dropwizard/swagger/SwaggerBundle.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
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;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import io.dropwizard.views.ViewBundle;
import io.swagger.jaxrs.config.BeanConfig;
import io.swagger.jaxrs.listing.ApiListingResource;

/**
* A {@link io.dropwizard.ConfiguredBundle} that provides hassle-free configuration of Swagger and Swagger UI
Expand All @@ -38,12 +37,7 @@ public abstract class SwaggerBundle<T extends Configuration> implements Configur

@Override
public void initialize(Bootstrap<?> bootstrap) {
bootstrap.addBundle(new ViewBundle<Configuration>() {
@Override
public ImmutableMap<String, ImmutableMap<String, String>> getViewConfiguration(final Configuration configuration) {
return ImmutableMap.of();
}
});
bootstrap.addBundle(new ViewBundle<>());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* For the meaning of all these properties please refer to Swagger documentation or {@link com.wordnik.swagger.jaxrs.config.BeanConfig}
* For the meaning of all these properties please refer to Swagger documentation or {@link io.swagger.jaxrs.config.BeanConfig}
*
* @author Tristan Burch
* @author Federico Recio
Expand All @@ -30,7 +30,7 @@ public class SwaggerBundleConfiguration {
/**
* This is the only property that is required for Swagger to work correctly.
* <p/>
* It is a comma separated list of the all the packages that contain the {@link com.wordnik.swagger.annotations.Api}
* It is a comma separated list of the all the packages that contain the {@link io.swagger.annotations.Api}
* annoted resources
*/
@JsonProperty
Expand Down
10 changes: 0 additions & 10 deletions src/test/java/io/federecio/dropwizard/swagger/DropwizardTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.jayway.restassured.RestAssured;
import com.wordnik.swagger.jaxrs.listing.ApiListingResource;
import org.eclipse.jetty.http.HttpStatus;
import org.hamcrest.core.StringContains;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -47,13 +44,6 @@ public void setPort() {
RestAssured.port = port;
}

@BeforeClass
public static void crap() throws Exception {
Field initialized = ApiListingResource.class.getDeclaredField("initialized");
initialized.setAccessible(true);
initialized.set(null, false);
}

@Test
public void resourceIsAvailable() throws Exception {
RestAssured.expect().statusCode(HttpStatus.OK_200).when().get(Path.from(basePath, "test.json"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package io.federecio.dropwizard.swagger;

import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
Expand Down