Skip to content
PluginStats

prettier-plugin-openapi weekly downloads statistics

By LukasParke · npm · Prettier plugins

A Prettier plugin for formatting OpenAPI/Swagger JSON and YAML files

View on npm Fresh · Dec 6, 2026

prettier-plugin-openapi has 47 recorded weekly downloads on npm, an increase of 30.6% over the past 30 days, ranking #2782 of 3,247 tracked listings.

Weekly downloads
47
Official API · Dec 5, 2026
7-day growth
+38.2%
+13 weekly downloads
30-day growth
+30.6%
+11 weekly downloads
90-day growth
+161%
+29 weekly downloads
Rank
#2782
▼ 102 in 7 days

About prettier-plugin-openapi

Prettier Plugin OpenAPI

A Prettier plugin for formatting OpenAPI/Swagger JSON and YAML files with intelligent key sorting, proper indentation, and support for modular OpenAPI file structures.

Features

  • 🎯 OpenAPI/Swagger Support: Formats both JSON and YAML OpenAPI specifications
  • 🔄 Smart Key Sorting: Automatically sorts OpenAPI keys in the recommended order
  • 📁 Modular File Support: Handles both monolithic and modular OpenAPI file structures
  • 🧩 Component Files: Supports individual component files (schemas, parameters, responses, etc.)
  • 📝 YAML & JSON: Supports both .yaml/.yml and .json file formats
  • 🎨 Consistent Formatting: Applies consistent indentation and line breaks
  • 🔌 Vendor Extensions: Programmatic loading of vendor-specific extensions
  • ⚡ Fast: Built with performance in mind using modern JavaScript
  • 🧪 Comprehensive Testing: 142 tests with 95.69% line coverage
  • 🚀 CI/CD Ready: Automated testing, building, and publishing
  • 🔒 Strict Validation: Properly rejects non-OpenAPI content
  • 📊 High Quality: Biome, Prettier, and TypeScript for code quality

Current Status

✅ Production Ready: Version 1.0.1 with comprehensive test coverage
✅ Modern Tooling: Updated to use Biome for fast linting and formatting
✅ Comprehensive Testing: 142 tests covering all major functionality
✅ High Performance: Optimized for large OpenAPI files
✅ Active Development: Regular updates and improvements

Installation

This plugin has a prettier peer dependency and works with Prettier 3 on Node 18+.

npm install --save-dev prettier prettier-plugin-openapi
# or
pnpm add --save-dev prettier prettier-plugin-openapi
# or
yarn add --dev prettier prettier-plugin-openapi
# or
bun add --dev prettier prettier-plugin-openapi

Usage

Command Line
# Format a single file
pnpx prettier --write api.yaml

# Format all OpenAPI files in a directory
pnpx prettier --write "**/*.{openapi.json,openapi.yaml,swagger.json,swagger.yaml}"

# Format with specific options
pnpx prettier --write api.yaml --tab-width 4 --print-width 100
Configuration

Add the plugin to your Prettier configuration:

package.json

{
  "prettier": {
    "plugins": ["prettier-plugin-openapi"]
  }
}

.prettierrc

{
  "plugins": ["prettier-plugin-openapi"],
  "tabWidth": 2,
  "printWidth": 80
}

.prettierrc.js

module.exports = {
  plugins: ['prettier-plugin-openapi'],
  tabWidth: 2,
  printWidth: 80,
};
Repo Setup

For a typical repository, add a couple of scripts so local development and CI use the same commands:

package.json

{
  "scripts": {
    "format": "prettier --write \"openapi/**/*.{yaml,yml,json}\"",
    "format:check": "prettier --check \"openapi/**/*.{yaml,yml,json}\""
  }
}

.prettierrc.json

{
  "plugins": ["prettier-plugin-openapi"]
}

Then you can run:

npm run format
npm run format:check

Adjust the openapi/**/*.{yaml,yml,json} glob to match wherever your specs live.

GitHub Actions

If you want formatting to run whenever main is updated and automatically push formatting fixes back to pull requests, you can use autofix.ci.

  1. Install the autofix.ci GitHub App for your repository.
  2. Add a workflow like this:

.github/workflows/format-openapi.yml

name: Format OpenAPI

on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read

jobs:
  format:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: 20

      - run: npm ci
      - run: npm run format

      - uses: autofix-ci/action@7a166d7532b277f34e16238930461bf77f9d7ed8

This runs the same Prettier command on pushes to main and on pull requests, while autofix.ci writes any formatting changes back to the PR branch for you.

If you only want CI to verify formatting instead of auto-fixing it, replace npm run format with npm run format:check and remove the autofix-ci step.

Supported File Extensions

  • .openapi.json
  • .openapi.yaml
  • .openapi.yml
  • .swagger.json
  • .swagger.yaml
  • .swagger.yml
  • .json (for component files)
  • .yaml / .yml (for component files)

Modular File Structure Support

The plugin supports both monolithic and modular OpenAPI file structures:

Monolithic Structure
api.yaml                    # Single file with everything
Modular Structure
├─ openapi.yaml             # Root document
├─ paths/                    # Path files
│  ├─ users.yaml
│  ├─ users_{id}.yaml
│  └─ auth_login.yaml
├─ components/               # Component files
│  ├─ schemas/
│  │  ├─ User.yaml
│  │  ├─ UserCreate.yaml
│  │  └─ Error.yaml
│  ├─ parameters/
│  │  ├─ CommonPagination.yaml
│  │  └─ UserId.yaml
│  ├─ responses/
│  │  ├─ ErrorResponse.yaml
│  │  └─ UserResponse.yaml
│  ├─ requestBodies/
│  │  └─ UserCreateBody.yaml
│  ├─ headers/
│  │  └─ RateLimitHeaders.yaml
│  ├─ examples/
│  │  └─ UserExample.yaml
│  ├─ securitySchemes/
│  │  └─ BearerAuth.yaml
│  ├─ links/
│  │  └─ UserCreatedLink.yaml
│  └─ callbacks/
│     └─ NewMessageCallback.yaml
└─ webhooks/                 # Webhook files
   └─ messageCreated.yaml

Key Sorting

The plugin automatically sorts OpenAPI keys in the recommended order:

📖 Complete Key Reference: For a comprehensive reference of all keys, their ordering, and detailed reasoning, see KEYS.md.

Examples

Monolithic File Structure
Before (unformatted):
paths:
  /users:
    get:
      responses:
        '200':
          description: OK
components:
  schemas:
    User:
      type: object
openapi: 3.0.0
info:
  version: 1.0.0
  title: My API
```…

Description from the npm listing.

  • prettier
  • prettier-plugin
  • openapi
  • swagger
  • yaml
  • json
  • formatting

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

prettier-plugin-openapi weekly downloads on npm, last 90 days: 47 weekly downloads as of Dec 5, 2026, +161% over 90 days.prettier-plugin-openapiWeekly downloads on npm · Last 90 days47downloads / week+161% over 90 days01020304050Sep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
prettier-plugin-openapi weekly downloads on npm, last 90 days: 47 weekly downloads as of Dec 5, 2026, +161% over 90 days.

7/30/90-day growth

prettier-plugin-openapi weekly downloads growth on npm: +38.2% over 7 days, +30.6% over 30 days, +161% over 90 days.prettier-plugin-openapiWeekly downloads growth on npm47downloads / week now7-day growth+13 weekly downloads+38.2%30-day growth+11 weekly downloads+30.6%90-day growth+29 weekly downloads+161%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
prettier-plugin-openapi weekly downloads growth on npm: +38.2% over 7 days, +30.6% over 30 days, +161% over 90 days.

Ranking history

prettier-plugin-openapi npm ranking history: currently #2782 (by weekly downloads).prettier-plugin-openapinpm ranking · by weekly downloads · Last 90 days#2782current rank#1600#1800#2000#2200#2400#2600#2800#3000Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
prettier-plugin-openapi npm ranking history: currently #2782 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 140, #2 (overall #2,782)
All npm: every listing in weekly downloads order

Listing placement

Prettier plugins267 listings · 14 pages · page 6, #16 (overall #116)
Prettier plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for prettier-plugin-openapi
Date (UTC)Weekly downloadsChange vs. previous
47-1
48+4
44+28
16-2
18+1
17+1
16-18
34+2
32-5
37-1
38-2
40-2
42-2
44—

Similar npm Prettier plugins plugins

All 20 prettier-plugin-openapi alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/prettier-plugin-openapi. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.