Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swagger for SpringMVC - Alternatives to Springfox?

Can any of you suggest any alternatives for implementing Swagger for Spring MVC based REST API? FYI, this is not Spring boot. I've tried Springfox, but IMHO it is a buggy mess.

like image 211
Mr Smith Avatar asked May 04 '17 13:05

Mr Smith


People also ask

Is Springdoc better than Springfox?

springdoc is a much more recent library that does not have so much legacy code as Springfox. As a consequence of the first one, springdoc is actually updated regularly and the amount of open issues is relatively small (only 11 vs 270 on Springfox).

What is Swagger Springfox?

Springfox is a framework that acts as the “glue” between Swagger and Spring. It generates the specification (contract) based on your code and also deploys the Swagger UI client with your application, allowing you to immediately test your REST API.

Can we use Swagger in Spring MVC?

Springfox has replaced Swagger-SpringMVC, and now supports both Swagger specs 1.2 and 2.0. The implementation classes have changed, allowing for some deeper customization, but with some work. The documentation has improved, but still needs some details added for advanced configuration.


2 Answers

You could try using the Swagger Maven Plugin, which is a build time annotation processor. If you're using spring-boot with JaxRS you could use Swagger-Core, which is pretty similar to SpringFox. It knows how to interpret JAX-RS annotations rather than the spring annotations. With all of these libraries that infer based on implementation or annotations, you are going to encounter bugs/problems when you have esoteric service definitions, or scenarios the library authors haven't thought about.

If your goal is just to document the RESTful endpoints, there is the excellent Spring Rest Docs, which allows you to write documentation driven by tests. It even allows you to add hand-written documentation that can augment your generated documentation. However, it keep in mind that it does not generate the service specification in a machine readable form.

That said, being the library author for SpringFox, it would be useful if you could create specific issues to problems you're encountering with SpringFox. This will help improve the library for you and anyone else encountering the same bugs/issues. You can certainly rant on stack overflow, but Im afraid that may only get your question down votes at best.

like image 70
Dilip Krishnan Avatar answered Oct 18 '22 22:10

Dilip Krishnan


https://github.com/RabiAPI/Evalon4J

This is a command line tool for generating java restful api documentation,

NO ANNOYING CONFIGURATION AT ALL!!!

Supported frameworks

  • Spring MVC
  • JAX-RS
  • Swagger 2.0 Annotations
  • OpenAPI 3.0 Annotations
  • JSR303 Bean Validation
like image 33
WhiteCosm0s Avatar answered Oct 18 '22 21:10

WhiteCosm0s