Reputation: 740
I am developing a web application using Angular 11 frontend and a Jakarta EE 8 backend. My backend consists maily of JAX-RS end points, for which I wish to provide a Swagger 2.0 Documentation.
In another Spring-Boot project, I used Springfox and I am wondering whether there is a counterpart in the Jakarta EE world. I tried the following
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>1.6.2</version>
</dependency>
But this produces only the swagger.json with no UI. Additionally, i would like to read the texts inside Swagger annotations e.g. @ApiOperation from a properties file, like I did with Spring e.g.
@ApiOperation(value = "${users.getAll.value}", notes = "${users.getAll.notes}")
Is there a library that can provide those features?
It is worth mentioning: My project use the pure Java/Jakarta EE API and runs on JBoss EAP 7.2.8, so no specific Jersey or RESTeasy implementations
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>
Upvotes: 4
Views: 6371
Reputation: 740
Again my requirements were:
It seems no solution with OpenAPI-2.0. So I used the following link to integrate swagger-ui (so only the first requirement are somehow done) https://synaptiklabs.com/posts/adding-swagger-to-a-javaee-project-javaee-series-2-part-2/
But with OpenAPI-3.0, the Eclipse Microprofile OpenAPI api is worth trying
<!-- 1. OpenAPI API -->
<dependency>
<groupId>org.eclipse.microprofile.openapi</groupId>
<artifactId>microprofile-openapi-api</artifactId>
<version>${microprofile-openapi-api-version}</version>
</dependency>
<!-- 2. Swagger-ui -->
<dependency>
<groupId>org.microprofile-ext.openapi-ext</groupId>
<artifactId>openapi-ui</artifactId>
<version>${openapi-ui-version}</version>
</dependency>
However I could not test it my self, as I am working on JBOSS EAP-7.2.9 and the above API is supported starting version 7.3.1 XP 1.0.0
Upvotes: 1
Reputation: 492
Adding the swagger-ui dependency may help.
<dependency>
<groupId>org.microprofile-ext.openapi-ext</groupId>
<artifactId>swagger-ui</artifactId>
<version>1.0.3</version>
</dependency>
Source:
https://ralph.blog.imixs.com/2020/05/08/microprofile-openapi-and-swagger-ui/
https://github.com/microprofile-extensions/openapi-ext/tree/master/openapi-ui
Upvotes: 0