dropwizard-swagger icon indicating copy to clipboard operation
dropwizard-swagger copied to clipboard

Add support for Swagger 2.0 spec

Open federecio opened this issue 9 years ago • 18 comments

As Swagger 2.0 spec has been recently released, it would be ideal to update the project so that it supports it. The problem is not in the Java side but on the UI since it seems that Swagger UI still doesn't fully support the 2.0 spec.

Will report back here about my findings. cc / @muralidharz

federecio avatar Sep 25 '14 00:09 federecio

Very cool! This made adopting Swagger a lot simpler! Shame about the UI not being ready, as it is a key bit to adopting the use of swagger. On Sep 24, 2014, at 8:01 PM, Federico Recio [email protected] wrote:

As Swagger 2.0 spec has been recently released, it would be ideal to update the project so that it supports it. The problem is not in the Java side but on the UI since it seems that Swagger UI still doesn't fully support the 2.0 spec.

Will report back here about my findings. cc / @muralidharz

— Reply to this email directly or view it on GitHub.


Eric Pugh | Principal | OpenSource Connections, LLC | 434.466.1467 | http://www.opensourceconnections.com | My Free/Busy
Co-Author: Apache Solr 3 Enterprise Search Server
This e-mail and all contents, including attachments, is considered to be Company Confidential unless explicitly stated otherwise, regardless of whether attachments are marked as such.

epugh avatar Sep 25 '14 14:09 epugh

@federecio any success ?

bdronneau avatar Jan 09 '15 12:01 bdronneau

Although Swagger 2 spec is final, the corresponding artifacts have not yet been finalized. The first Swagger release supporting Swagger 2 spec is going to be version 1.5.0

Reference: https://github.com/swagger-api/swagger-core/milestones

federecio avatar Feb 14 '15 07:02 federecio

I believe we may be ready for that now. Please let me know if you need any assistance.

webron avatar Feb 25 '15 16:02 webron

:+1: for the upgrade plans @federecio, great project, will look forward to it! :)

aeells avatar Feb 25 '15 16:02 aeells

thanks for chiming in @webron . I now see the JAX-RS jars deployed under version 1.5.2-M1

It's definitely interesting to enable users to get the most out of Swagger's newest spec!

federecio avatar Feb 26 '15 02:02 federecio

Has anyone started to look into issue for this project? I have a very simple sample DW application that I got working with 1.5.0-M2 . Beside support for the new swagger spec, a VERY nice thing is that it no longer requires all the Scala libraries, since it's "pure" java. Much smaller shaded jars is one nice benefit from that.

skjegg avatar Apr 10 '15 13:04 skjegg

Hi @skjegg do you have your app in Github? Could you send me a link?

federecio avatar Apr 13 '15 01:04 federecio

@webron what tag should I be using? Is it v1.5.0-M2 or v1.5.3-M1? I would normally choose v1.5.3-M but https://github.com/swagger-api/swagger-core/releases says that v1.5.0-M2 is the latest. Thanks!

federecio avatar Apr 13 '15 01:04 federecio

@federecio - 1.5.1-M2 is the latest. The develop_2.0's dropwizard sample works, if you want.

webron avatar Apr 13 '15 05:04 webron

@federecio - No, it's an internal app, so I can't really share it. It took me a bit of trial and error to exclude dependencies that clashed with dropwizard's jersey/jackson. Basically, swagger seems to pull in lower versions of Jersey/Jackson, causing startup failures. I don't know that this is 100%, but here's what I've currently got in my pom.xml. Hope it helps someone :

   <dependency>
        <groupId>com.wordnik</groupId>
        <artifactId>swagger-core</artifactId>
        <version>1.5.0-M2</version>
        <exclusions>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.wordnik</groupId>
        <artifactId>swagger-jersey2-jaxrs</artifactId>
        <version>1.5.0-M2</version>
        <exclusions>
            <exclusion>
                <groupId>org.glassfish.jersey.media</groupId>
                <artifactId>jersey-media-multipart</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.glassfish.jersey.containers</groupId>
                <artifactId>jersey-container-servlet-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

skjegg avatar Apr 13 '15 14:04 skjegg

And here's the swagger specific code in the DW Application's run method. I should also mention that I'm using DW 0.8.0

    // Swagger needs this..
    environment.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);

    BeanConfig swaggerConfig = new BeanConfig();
    swaggerConfig.setTitle("Sample API");
    swaggerConfig.setContact("[email protected]");
    swaggerConfig.setVersion("0.0.1");
    swaggerConfig.setBasePath("");
    swaggerConfig.setResourcePackage("com.XXX.XXX.sample");
    swaggerConfig.setScan(true);

    environment.jersey().register(new ApiListingResource());


skjegg avatar Apr 13 '15 14:04 skjegg

those interested in swagger 2.0 : https://github.com/swagger-api/swagger-core/tree/develop_2.0/samples/java-dropwizard

carchrae avatar Apr 24 '15 10:04 carchrae

Hey @federecio Love the project. I'm currently doing a POC where we are moving from SOAP based services into Restful. One of the options I'm looking at is Dropwizard as main framework and because we would like to have Swagger Documentation then your project obviously popped out.

The Swagger Editor looks to be a great tool to have conversations with Technical and Non-Technical folks, but obviously only works with Swagger 2.0 spec, so I was interested in approx timelines for 2.0 support.

Just noticed @carchrae comment, so will check that out.

Cheers

ghost avatar Apr 24 '15 10:04 ghost

Thanks everybody for your interest. I want to you let you now that I deployed a new release under version 0.7.0 that adds support to Swagger 2. I hope you get a chance to test it out and let me know if it works for you.

If you are giving it a try please check out the readme as the I polished the way to set up the bundle to be more Dropwizard-style.

Thanks!

federecio avatar Apr 27 '15 05:04 federecio

HI @federecio, I really love this library. It just makes things lot simpler.

Issue https://github.com/swagger-api/swagger-js/issues/186 seems to be resolved in 2.1. This will block lot of users Can we have a new release for the same.

VivekAgarwal15061985 avatar Jun 30 '15 09:06 VivekAgarwal15061985

@federecio, I'm using 0.7.0 and I'm unable to get file uploads working. You can check https://groups.google.com/forum/#!topic/swagger-swaggersocket/Bl39e23PIDQ For a simple example

greenreign avatar Jul 08 '15 18:07 greenreign

It appears that several pieces are fixed, deprecated, improved since the version we are using (1.5.1-M2). An upgrade to 1.5.0 (yes, strange but that's an upgrade) should at least help with multipart, description bugs, bring the framework up to speed with new annotations and deprecate annotations that already are broken in 1.5.1-M2.

greenreign avatar Jul 14 '15 12:07 greenreign