Configuring Swagger

Overview

This is a document for developers to know what to pay attention to in order to get the swagger API to load and respond properly.

Details

There are two files in which the value ${base.url} parameter must be interpolated so that it deploys properly.  Both are in the term-server-rest project.

  • swagger.html
  • web.xml

Now, the value of base.url is configured from the "config artifact" used to build the .war.   By default, this is the "config/windows-dev" artifact and useshttp://localhost:8080/umls-server-rest which should work for most dev environments.  

If you have special deployment needs, create your own config project based on this one and configure that appropriately for your deployment (see how "config/prod" has a different config.properties file than "config/dev-windows").  Then, when building the terminology server project, you can pass 3 variables (config.groupId, config.artifactId, config.version) to indicate which config artifact should be used to obtain a config.properties, and thus a base.url setting.  This is described to some extent in the Building and Deploying in Eclipse page.

In the final deployment .war, the web.xml should have a properly configured swagger.api.basepath, as in:

 

<init-param>
  <!-- This URL is the path to the REST web service itself. In the index.html
    page is the path to the api-docs page -->
  <param-name>swagger.api.basepath</param-name>
  <param-value>${base.url}</param-value>
</init-param>

 

And the swagger.html should have a properly configured url setting, as in:

 

$(function () {
  window.swaggerUi = new SwaggerUi({
  url: "${base.url}/api-docs",

 

If necessary, you can edit these things manually.