4

What is the difference between swagger-api and JAX-RS ?

Is the swagger-api only for documentation? (for example @ApiOperation)

2 Answers 2

8

As per the API docs, JAX-RS is the Java API for RESTful Web Services that provides portable APIs for developing, exposing and accessing Web applications designed and implemented in compliance with principles of REST architectural style.

Swagger, on the other hand, comes in picture when you have implemented your restful web services using any of the JAX-RS implementations (Jersey, RestEasy, Apache-CXF, etc as already mentioned by @Bijoy). Swagger adds form to your APIs by making them look good and presentable so that client code can be written easily, at the same time it also makes documentation a much less boring task by integrating it with code. Needless to say, also saves the extra time it takes to document if done after coding is over. In this sense, it is a bit revolutionary.

3

jax-rs is REST specification, and it is implemented by ones like jersey, resteasy etc, swagger is more on documenting and it has an easy interface if you want to test and make lot easier from different platform for adapt your rest functionalities

2
  • so what is the different between ApiResponse annotation and Path annotation May 3, 2016 at 7:22
  • jax-rs specification uses annotations like GET, Path etc to differentiate method and api path etc, on similar lines swagger is also using a few annotations to generate meta data(Api, ApiResponses) for documentation (swagger uses these meta information for producing api.json, which is used by its clients)
    – Bijoy
    May 3, 2016 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.