I have an existing Spring REST API for which I want to generate the OpenAPI 3.0 YAML file and not Swagger 2.0 JSON/YAML?
Since as of now, SpringFox does not support YAML generation. It generates JSON with Swagger 2.0 (which follows OPEN API 3.0 spec).
Also, there is https://github.com/openapi-tools/swagger-maven-plugin but it does not seem to support Spring Rest.
I tried the Kongchen spring-maven-plugin which is able to generate the YAML file but with Swagger 2.0 definition and not OPEN API 3.0 like :
swagger: "2.0"
info:
description: "Test rest project"
version: "1.0"
title: "Some desc"
termsOfService: "http://swagger.io/terms/"
contact:
name: "Rest Support"
url: "http://www.swagger.io/support"
email: "[email protected]"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "example.com"
basePath: "/api/"
So my question is how can I generate the OPEN API YAML file like :
openapi: 3.0.0
info:
description: Some desc
version: "1.0"
title: Test rest project
termsOfService: http://swagger.io/terms/
contact:
name: Rest Support
url: http://www.swagger.io/support
email: [email protected]
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
I am currently using swagger-maven-plugin
to generate YAML file with Swagger 2.0 definition and converting it to Open API 3.0 definition using swagger2openapi
at https://mermade.org.uk/openapi-converter
Question 1:
Can spring-maven-plugin capture io.swagger.v3.oas.annotations
to generate the YAML ?
Question 2:
What is the best way to generate the YAML with OPEN API definitions in a Spring MVC Project?
Question 3:
Can io.swagger.v3.oas
be used with Spring projects or it is only for JAX-RS projects?