Skip to content

Symfony Command that calculates Open API documentation coverage

Notifications You must be signed in to change notification settings

Ferror/openapi-coverage

Repository files navigation

Coverage Status

Open API Coverage Calculator Symfony Bundle

The Open API Coverage Calculator Symfony Bundle enables you to track another system metric - The API Documentation Coverage. The library extracts your application API endpoints via Symfony Routing and checks them against NelmioAPIDocBundle, the most popular library for Open API Specification in the Symfony ecosystem.

Installation

composer require --dev ferror/openapi-coverage
// bundles.php

return [
    Ferror\OpenapiCoverage\Symfony\Bundle::class => ['dev' => true, 'test' => true],
];

Usage

php bin/console ferror:check-openapi-coverage

You can also specify the --threshold or (--t) option to define coverage level below which the command will fail.

php bin/console ferror:check-openapi-coverage --threshold 0.70

Example Result

Open API coverage: 75%
+- Missing documentation -+
| path          | method  |
+---------------+---------+
| /products/:id | get     |
+---------------+---------+