Springfox Swagger 2 vs 3 - spring

Recently Springfox Swagger 3 got released supporting OpenAPI 3. I was using Springfox Swagger 2 quiet a while which gives all the necessary stuffs to document the REST API and nowwhen I upgrade now to 3, I could find the UI is bit changed when compared to the 2 version.
Can anyone please tell me whats the real benefit which I will get from Springfox Swagger 3. Also what exactly this OpenAPI 3 specification really gives us to the Swagger API documentation

Related

Are there any advantages of using/migrating to springdoc-openapi from Springfox?

For enabling Swagger in SpringBoot 2.7 what are the advantages/disadvantages of choosing springdoc-openapi over Springfox
This might be considered opinion-based, but actually there are facts supporting the usage of springdoc over Springfox. Some of them:
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).
It simply works easily and without major issues in the most recent Spring Boot versions.
Springfox seems abandoned, to say the least.
At least this is my view.
As João Dias has correctly pointed out, Springfox is not maintained.
As a result of that, Springfox libraries don't work with Spring Boot 3.0.x. It is unclear who is going to fix it and whether it will be fixed at all.
At the moment (January 2023) it seems that the developer of a Spring Boot 3.0.x application willing to generate OpenAPI-compliant docs with Swagger is left with two options:
a) Switch back to Spring Boot 2.7 and use Springfox for Swagger
b) Choose Springdoc over Springfox

Upgrade from SpringFox2.x to SpringFox3.0 open API

We are trying upgrade SPringFox2.0 to 3.0 Open API Specification. But when we generate open doc using '' url it is showing version as 2.0. Not sure why the version still pointing to old version.
We are using Springboot application
I followed the below steps to upgrade as per spring fox documentation
[http://springfox.github.io/springfox/docs/current/][1]
"2.1.3. Migrating from existing 2.x version"
Spring Boot Applications
1.Remove library inclusions of earlier releases. Specifically remove springfox-swagger2 and springfox-swagger-ui inclusions.
2.Remove the #EnableSwagger2 annotations
3.Add the springfox-boot-starter
4.Springfox 3.x removes dependencies on guava and other 3rd party libraries (not zero dep yet! depends on spring plugin and open api libraries for annotations and models) so if you used guava predicates/functions those will need to transition to java 8 function interfaces
I followed all the steps above, 'http://localhost:XXXX/api/v1/api-docs?group=API_Version_1' it got generated but version is showing 2.0
{"swagger":"2.0","info":{ ........
And also I modified in SwaggerConfig: DocumentationType.SWAGGER_2 TO DocumentationType.OAS_30 (it is not mentioned documentation, I guess they missed it)
I believe still some thing is missing, Spring Fox documentation is still out of date and poor coverage of 3.0 aspects.
I am wondering any one having same problem?
Try to use /v3/api-docs or /api/v3/api-docs in your case.
That did not work.
As per Spring fox documentation:
"The /v2/api-docs URL is the default that SpringFox uses for documentation. The v2 does not refer to your API's documentation version (which can be changed in the Docket configuration), but the version of the Swagger specification being used..."
springfox.documentation.swagger.v2.path=/my/docs (path of yours)

Spring Security 5 + Spring 4 - Is this supported?

We have a need to use the new Spring Security 5 OAuth 2 libraries in one of our apps but it is using spring 4. Do we have to upgrade the Spring Core libraries to version 5 to match the Spring Security 5 version? Pretty certain that we have to do this, but its a non trivial effort so trying to understand if it is necessary.

golang swagger annotations for rest api

I have written swagger annotations for my REST APIs. However swagger documentation is created only for the last declaration (for a particular endpoint). Is it possible to create swagger documentation through annotations for non unique endpoints?
My code can be found here - https://github.com/SejalAbhangrao/go_web_app_with_swagger_and_test_cases/blob/master/book_handlers.go
Any help will be appreciated!

swagger ui not working for swagger version 2

I am currently working on a project involving spring-boot and swagger. I have upgraded my maven spring boot project to the latest Swagger using the link Upgrade to version2.
I am currently using the Swagger-UI which I have configured from the link Swagger-UI with Spring Boot
I try to access the url : localhost:8080/swagger/index.html after deploying the app successfully on my tomcat server. Unfortunately, it does not work and I am unable to view the swagger-ui in my browser. How do I go on about it further?
I think you're mixing the documentation of 2 versions of the library. The second link points to an older version of the springfox library. Please follow the instructions in the latest snapshot of the documentation. If you've configured everything correctly you should see the swagger-ui at http://localhost:8080[/CONTEXT-PATH]/swagger-ui.html. Depending on how you've set your springboot app the context path is optional.

Resources