[Parser] Decouple code from Swagger-Core
Created by: jmini
I would like to investigate if it is possible to replace usage of
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<version>2.0.6</version>
</dependency>
With the interfaces defined in Eclipse MicroProfile:
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<version>2.0-MR1</version>
</dependency>
To model existing OpenAPI specifications, the Eclipse MicroProfile is using a model that is really similar to what Swagger-Core is providing. But it follows the JavaEE principle: there is a clear API with interfaces and different vendors can implement them.
With the release of the EMPOA project, we have a way to continue to use Swagger-Parser as we did before. EMPOA Swagger-Core is a bridge that implements the Eclipse MicroProfile interface by delegating to the Swagger-Core objects.
With this approach, the output of Swagger-Parser can be consumed as valid Eclipse MicroProfile implementation:
io.swagger.v3.oas.models.OpenAPI swaggerOpenAPI = parserResult.getOpenAPI();
OpenAPI openAPI = SwAdapter.toOpenAPI(swaggerOpenAPI);
Advantage of this approach: decoupling!
The EMPOA project could implement a second wrapper for the model used by KaiZen-OpenAPI-Parser. This way we would have an alternative for corner cases that are not well supported by Swagger-Parser.