swagger-api / swagger-core

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
http://swagger.io
Apache License 2.0
7.36k stars 2.17k forks source link

Jersey 2.x support #271

Closed ddragosd closed 10 years ago

ddragosd commented 10 years ago

With Jersey version 2.1 ( at the time of writing this ), I'm wondering if there are any plans or ongoing work to support Jersey 2.x. ( currently only jersey 1.x is supported )

I'm working on adding support for Jersey 2.1 in one of my projects, and it would be nicer to have it as part of swagger. If there's ongoing work, I'd be interested to contribute there, else, I could start something fresh that brings support for Jersey 2.x.

Before submitting a pull request I'd like to know your thoughts on what is the best way to approach this; should we have new module swagger-jersey2-jaxrs similar with -play and -play2 ?

fehguy commented 10 years ago

Yes, we will support jersey2 shortly. It should be quite easy to transition the 1.3 branch to support jersey, and I think swagger-jersey2-jaxrs would be a good module name since jersey 1.x will be in use for a long time.

ddragosd commented 10 years ago

Thanks. Does this mean you have an ongoing work, or should I implement it and make a pull request afterwards into the master branch, and then transition that to 1.3 branch ?

fehguy commented 10 years ago

I suggest you start on the 1.3-RC3 branch since it has been refactored to make it simple to plug in readers now. The 1.2.x branch will be a lot of code repeat...

ddragosd commented 10 years ago

I've tried creating a pull request only with bd1b2d1 commit but couldn't make it. I'll investigate more how to make it happen. In the mean-while I'd also like to check that this works with scala 2.10.0 as well.

lennartkoopmann commented 10 years ago

Any news on this? We are eagerly waiting for Jersey 2.x support. :) Do you think it is ready for a SNAPSHOT release?

Please let us know if we can help with something.

ddragosd commented 10 years ago

It is fixed, it is working, but it is not integrated back into the scala_2.10.0 branch as of now. For Jersey2 you'd have to use swagger-jersey2-jaxrs module.

fehguy commented 10 years ago

see here:

https://github.com/wordnik/swagger-core/tree/develop/modules/swagger-jersey2-jaxrs

https://oss.sonatype.org/content/repositories/snapshots/com/wordnik/swagger-jersey2-jaxrs_2.10/

lennartkoopmann commented 10 years ago

Thanks! :)

sujeet100 commented 10 years ago

Hi .. I tried to integrate swagger with jersey2.2 and spring using swagger-jersey2-jaxrs. It has started creating problems in injection of spring beans. Most probably this is because of the conflicting version of reflections jar. Spring(3.4/3.3) uses 0.9.5 while swagger uses 0.9.8.

Can you please create a sample application with Spring MVC + jersey 2.2 + swagger-jersey2-jaxrs

fehguy commented 10 years ago

I think you'll have to try changing dependencies in your project, and possibly forking swagger-core to match what you need. It's impossible to support every combination of frameworks

lennartkoopmann commented 10 years ago

We invested a few hours into writing our own annotation parser. All you need to to is generate that JSON API description somewhere and that is reasonably simple usually. :)