-
Notifications
You must be signed in to change notification settings - Fork 0
OpenAPI with WildFly
After starting the WildFly with the standalone.bat you can reach the server on http://localhost:9990/
.
On the Homepage navigate to the tab Configuration
then on the left tabs Subsystems
-> MicroProfile Config
then click on View.
To add configurations values you just have to clock on the Add button on the right side of the your view.
Config Source
Name -> Enter a name for your configuration e.g. "OpenAPI"
Source -> Select "Properties"
Next
Attributes
Add the following three Properties
(Note: Press ↵ to add and ⌫ to remove them.)
mp.openapi.extensions.enabled=true
mp.openapi.extensions.path=/openapi
mp.openapi.extensions.servers.relative=true
It should look like this then
Next
Ordinal
You can leave Ordinal empty :)
Finish
You should have an entry like in the following picture.
Now we need to add some swagger dependencies.
Mandatory
implementation 'io.swagger.core.v3:swagger-jaxrs2:2.2.0'
implementation 'io.swagger.core.v3:swagger-jaxrs2-servlet-initializer:2.2.0'
Optional
implementation 'org.webjars:swagger-ui:4.10.3'
Mandatory
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2-servlet-initializer</artifactId>
<version>2.2.0</version>
</dependency>
Optional
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>4.10.3</version>
</dependency>
After setting up the above two points you can start your WildFly Remote Deployment
Visit the link http://localhost:8080/musicshop-1.0/api/openapi.json
Enjoy the unformatted JSON ;) (non-Firefox users)