This commit adds the ability to autogenerate swagger docs (but really
swagger.json) by scanning through the JAX-RS classes (from package
'com.redhat.thermostat.server.core.internal.web.http') and using the
JAX-RS annotations to generate the swagger definitions.
The swagger generated is found in '/swagger.json'
This feature is activated when the 'SWAGGER_UI_ENABLED' feature is
switched on.
To be able to activate the Swagger generation, I thought that it was
necessary to extend the ResourceConfig class to be able to create a
new BeanConfig, which is necessary to configure Swagger. In the
future, if a web.xml file is used instead, this code could be removed.
This commit adds the ability to autogenerate swagger docs (but really swagger.json) by scanning through the JAX-RS classes (from package 'com.redhat.thermostat.server.core.internal.web.http') and using the JAX-RS annotations to generate the swagger definitions.
The swagger generated is found in '/swagger.json'
This feature is activated when the 'SWAGGER_UI_ENABLED' feature is switched on.
To be able to activate the Swagger generation, I thought that it was necessary to extend the
ResourceConfig
class to be able to create a newBeanConfig
, which is necessary to configure Swagger. In the future, if aweb.xml
file is used instead, this code could be removed.The relevant document was used to configure Swagger with Jersey for auto-swagger doc generation: https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5
The root web path for the swagger's index.html is also moved from '/index.html' to '/apidocs' to avoid any naming collisions that might happen.