Swagger UI is a javascript library which allows a user to explore the api documentation for a web services API. This module provides the Swagger UI library for display of OpenAPI specifications within Drupal site. OpenAPI UI is required to use the project, as it provides the underlying architecture.

Swagger UI for Drupal's APIs

Looking to view documentation on Drupal's APIs? While this module doesn't provide the documentation, you can install it alongside OpenAPI module to view docs for the JSON:API and REST modules, to display documentation on core's rest modules.

Please visit the OpenAPI project page for more information.

Installation

This module can be installed the same as any other Drupal module.

This module has two dependencies.

The Swagger UI Library can either be installed via Composer or manually. Version 3.0.17 is the recommended version of the swagger UI library at this time. Other versions of the libaray may cause issues with content display or schema parsing.

Installation with Composer

To install the library via composer, you will need to configure composer to put the library in the correct location for Drupal. This requests the composer/installers and mnsami/composer-custom-directory-installer packages. You can run the following command to ensure they are installed.

composer require composer/installers mnsami/composer-custom-directory-installer

Then modify your project's composer.json to include the following configuration.

"extra": {
  "installer-paths": {
    ...
    "web/libraries/{$name}": ["swagger-api/swagger-ui", "type:drupal-library"],
    ...
  }
}

Manual Installation

The library can be manually downloaded from Github and extracted into the libraries directory (/libraries/swagger-ui) in your Drupal installation.

Alternative UI Libraries

Swagger UI is not the only option for viewing OpenAPI Docs. Please visit the OpenAPI UI module to view a list of supported integrations.

Project information

Releases