Integrations

API revisions

Since 1.2
Generate one OpenAPI document per revision of a JSON:API application built on ark4ne/laravel-api-revisions.

With Laravel JSON:API 3.x, an API has dated revisions: each client is pinned on one, and the code keeps only the latest shape. The generator writes one document per revision, each one showing the API exactly as a client of that revision sees it.

Laravel API Revisions
Typed schemas for Laravel resources and form requests, evolved through dated API revisions, Stripe-style.
v1.0.0ark4ne/laravel-api-revisions

One document per revision

Each document names its revision in its integrations.json_api.revision setting, a case of the enum the application configures in revisions.enum of ark4ne/laravel-api-revisions:

config/openapi.php
'documents' => [
    'v2026-09' => [
        'info' => ['title' => 'API', 'version' => '2026-09-01'],
        'integrations' => [
            'json_api' => ['revision' => App\Http\ApiRevision::Initial],
        ],
    ],
    'v2026-12' => [
        'info' => ['title' => 'API', 'version' => '2026-12-01'],
        'integrations' => [
            'json_api' => ['revision' => App\Http\ApiRevision::Labels],
        ],
    ],
],

A document without the setting documents the head, the latest revision.

What changes per revision

Every request the generator builds, the samples and the form requests, is read at the revision of the document. A field renamed by was() has its old name, a field added by since() is absent before, one removed by until() is absent after:

'label' => Schema::string('title')->max(120)->describe('The title.')
    ->was(ApiRevision::Initial, name: 'name'),
'summary' => Schema::string('content')->nullable()->since(ApiRevision::Labels),
'status' => Schema::enum(Stage::class)->until(ApiRevision::Initial),

The relationships, the nested resources, the include and fields[type] parameters and the rules of the form requests follow the revision too.

Changelog in the description

The description of each document lists the newer revisions, from the #[Meta] of their cases:

Newer revisions:

- 2026-12-01: Names become labels
- 2027-01-15: Members replace writers

Checks

The resources of each document are checked at its revision, as jsonapi:check does: its findings are warnings of the document, with their code and revision, so --strict fails on them.

A resource that does not exist at the revision of a document is a warning: exclude its routes from that document with routes.exclude.

config/openapi.php
'v2026-09' => [
    'routes' => ['include' => ['api/*'], 'exclude' => ['api/labels*']],
    'integrations' => [
        'json_api' => ['revision' => App\Http\ApiRevision::Initial],
    ],
],