In a very simple Wildfly Swarm project Swagger works fine and produces the expected swagger.json
output. But as soon as a second java package is added to the project, it doesn't work anymore.
Example (see https://github.com/pe-st/swagger42 example project):
HelloWorldEndpoint
in the package ch.schlau.pesche.swagger42.rest
)the second commits adds minimal Swagger annotations and generates the following swagger.json
:
{
"swagger": "2.0",
"info": {},
"basePath": "/",
"paths": {
"/hello": {
"get": {
"summary": "Get the response",
"description": "",
"operationId": "doGet",
"produces": [
"text/plain"
],
"parameters": [],
"responses": {
"default": {
"description": "successful operation"
}
}
}
}
}
}
the third commit adds an empty class in a second java package ch.schlau.pesche.swagger42.core
. Now the generated swagger.json
looks like this:
{"swagger":"2.0","info":{},"basePath":"/"}
What has to be done to make Swagger work in projects like these?
https://wildfly-swarm.gitbooks.io/wildfly-swarm-users-guide/advanced/swagger.html
Create a file META-INF/swarm.swagger.conf
and add following entry:
packages:ch.schlau.pesche.swagger42.rest
There is a info in the startup:
[org.wildfly.swarm.swagger] (main) WFSSWGR0004: Configure Swagger for deployment
demo.war with package ch.schlau.pesche.swagger42.core
or similar, which packages is scanned.