Advertising sustains the DA. Ads are hidden for members. Join today

Configure the module

Last updated on
12 April 2019

Configure the Swagger UI Field Formatter module by adding a new File or (since version 8.x-2.2) a Link type field to a content type such as Basic page.

Configuration for File type fields:

  1. Navigate to Structure > Content types > TYPE > Manage fields.
    Where TYPE is the content type to which you want to add the new field, such as a Basic page.
  2. Click on the Add field button to add a new field.
  3. Set the field type to File and enter a label name.
  4. Click Save and continue.
  5. On the Edit tab, in the Allowed file extensions field enter the following: yaml,yml,json
  6. Click Save settings.
  7. Click on the Manage display tab.
  8. Select Swagger UI in the Format drop-down for the new field.
  9. To configure the field formatter click Only local images are allowed. in the field row. 
  10. Click Save.
  11. Add a new TYPE type content and upload a valid Swagger file.

Configuration for Link type fields:

  1. Navigate to Structure > Content types > TYPE > Manage fields.
    Where TYPE is the content type to which you want to add the new field, such as a Basic page.
  2. Click on the Add field button to add a new field.
  3. Set the field type to Link and enter a label name.
  4. Click Save and continue.
  5. On the Edit tab manage your field settings as you wish.
  6. Click Save settings.
  7. Click on the Manage display tab.
  8. Select Swagger UI in the Format drop-down for the new field.
  9. To configure the field formatter click Only local images are allowed. in the field row. 
  10. Click Save.
  11. Add a new TYPE type content and provide a valid Swagger file path.

When viewing the page, the uploaded Swagger file will be rendered using the Swagger UI.

Note: If the content does not render correctly, try clearing the cache by navigating to Configuration > Development > Performance and clicking Clear all caches.

Help improve this page

Page status: No known problems

You can: