Swagger Support

Documentation and examples for rendering Swagger operations as Bootstrap accordions.

DITA Bootstrap Swagger is a DITA-OT plug-in that extends the HTML output. It renders each operation as a collapsed Bootstrap accordion item, colored by HTTP method.

Collapsed accordion items for each pet operation, with the GET /pet/findByStatus item expanded
Figure 1. The pet operations of the Swagger Petstore, with one operation expanded

Installing the DITA Bootstrap Swagger plug-in

Use the dita command to add the plug-in and its dependencies to your DITA Open Toolkit installation:

dita install fox.jason.passthrough.swagger
dita install org.dita-bootstrap.swagger

Using

To mark a file to be passed through for Swagger processing, label the <topicref> with @format="swagger" within the <map> as shown:

<map>
  ...etc
  <topicref format="swagger" href="swagger.json"/>
</map>

The Swagger file is converted to DITA and added to the build job. The title of the generated <topic> is the root name of the file, with any underscores replaced by spaces.