PHPackages                             testudio/swagger\_ui\_formatter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. testudio/swagger\_ui\_formatter

ActiveDrupal-module[API Development](/categories/api)

testudio/swagger\_ui\_formatter
===============================

Provides a Swagger UI field formatter for File and Link fields.

046PHP

Since Jun 27Pushed 5y agoCompare

[ Source](https://github.com/testudio/swagger_ui_formatter)[ Packagist](https://packagist.org/packages/testudio/swagger_ui_formatter)[ RSS](/packages/testudio-swagger-ui-formatter/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (4)Used By (0)

Swagger UI Field Formatter
==========================

[](#swagger-ui-field-formatter)

This Drupal module provides a field formatter for File and Link type fields which renders the referenced file using [Swagger UI](https://swagger.io/tools/swagger-ui/) if the file is a valid Swagger file. Supported file types are JSON (`.json`) and/or YAML (`.yml` or `.yaml`).

This module uses the [Swagger UI](https://github.com/swagger-api/swagger-ui) JavaScript library.

For a full description of the module, visit the [project page](https://www.drupal.org/project/swagger_ui_formatter) on [drupal.org](https://www.drupal.org/).

To submit bug reports and feature suggestions, or to track changes visit the module's [GitHub repository](https://github.com/Pronovix/swagger_ui_formatter).

Requirements
------------

[](#requirements)

Please note that the minimum supported Swagger UI library version is currently `3.32.2` as at the time of this release that's the latest version which includes security fixes.

Module installation
-------------------

[](#module-installation)

Install the Swagger UI Field Formatter module as you would normally install a contributed Drupal module. Visit the official [Installing Modules](https://www.drupal.org/node/1897420) documentation for further information.

Swagger UI library installation
-------------------------------

[](#swagger-ui-library-installation)

### Manual installation

[](#manual-installation)

Download the [appropriate Swagger UI library version](https://github.com/swagger-api/swagger-ui/releases), extract the archive and rename the folder to "swagger-ui". Place the renamed folder into the `[DRUPAL ROOT]/libraries` directory so its path will be `[DRUPAL ROOT]/libraries/swagger-ui`.

### Installation via Composer

[](#installation-via-composer)

If you would like to install the Swagger UI library with [Composer](https://getcomposer.org/), you probably used the [Project template for Drupal 8 projects](https://github.com/drupal/recommended-project)to set up your project. To install JavaScript libraries, it's recommended to use the [asset-packagist](https://asset-packagist.org/) repository. So you will need to add the following to your `composer.json` file in the "repositories" section:

```
{
    "type": "composer",
    "url": "https://asset-packagist.org"
}
```

It's also needed to extend the "extra/installer-paths" section with:

```
"web/libraries/{$name}": [
    "type:drupal-library",
    "type:bower-asset",
    "type:npm-asset"
],
"web/libraries/swagger-ui": ["bower-asset/swagger-ui"],
```

And add a new "installer-types" section next to "extra/installer-paths":

```
"installer-types": ["bower-asset", "npm-asset"],
```

After this you can install the library with the following command:

```
composer require oomphinc/composer-installers-extender bower-asset/swagger-ui
```

The library will be downloaded into the `[DRUPAL ROOT]/libraries` directory.

Configuration
-------------

[](#configuration)

### File fields

[](#file-fields)

1. In the Drupal administrative UI navigate to "Structure" &gt; "Content types" &gt; **TYPE** &gt; "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 and optionally configure the formatter settings.
9. Click "Save".
10. Add a new **TYPE** type content and upload a valid Swagger file.

### Link fields

[](#link-fields)

1. In the Drupal administrative UI navigate to "Structure" &gt; "Content types" &gt; **TYPE** &gt; "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 and optionally configure the formatter settings.
9. Click "Save".
10. Add a new **TYPE** type content and provide a valid Swagger file path.

When viewing the content page the uploaded or the referenced Swagger file will be rendered by Swagger UI.

Troubleshooting
---------------

[](#troubleshooting)

If the content of the Swagger file does not render correctly try clearing the cache by navigating to "Configuration" &gt; "Development" &gt; "Performance" on the Drupal administrative UI and clicking on the "Clear all caches" button.

If clearing the cache doesn't help, it's also worth to check the Swagger UI library related entry on the "Reports" &gt; "Status report" page to see whether the library got recognised correctly or there is any problem with it.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/76243406?v=4)[VladimirTes](/maintainers/VladimirTes)[@vladimirtes](https://github.com/vladimirtes)

---

Top Contributors

[![balazswmann](https://avatars.githubusercontent.com/u/1757012?v=4)](https://github.com/balazswmann "balazswmann (33 commits)")[![mxr576](https://avatars.githubusercontent.com/u/1755573?v=4)](https://github.com/mxr576 "mxr576 (18 commits)")[![VladimirAus](https://avatars.githubusercontent.com/u/1356166?v=4)](https://github.com/VladimirAus "VladimirAus (5 commits)")[![boobaa](https://avatars.githubusercontent.com/u/294106?v=4)](https://github.com/boobaa "boobaa (2 commits)")[![tamasd](https://avatars.githubusercontent.com/u/40811?v=4)](https://github.com/tamasd "tamasd (2 commits)")

### Embed Badge

![Health badge](/badges/testudio-swagger-ui-formatter/health.svg)

```
[![Health](https://phpackages.com/badges/testudio-swagger-ui-formatter/health.svg)](https://phpackages.com/packages/testudio-swagger-ui-formatter)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
