stefna/open-api-bundler

Cli tool to help inline/bundle open api specifications

1.6.1 2024-11-28 14:58 UTC

This package is auto-updated.

Last update: 2024-12-05 12:54:39 UTC


README

Build Status Latest Version on Packagist Software License

Provides a cli command to help bundle up OpenAPI specifications in to one file by resolving all the external references in the schema

Installation

Requires PHP 8.2+

composer require stefna/open-api-bundler

Usage

The bundler support both json files and yaml files.

Example files

You can find examples of specifications in the examples folder

Each example should have these files:

  • schema.json input schema
  • schema.dist.json bundled output
  • schema.dist.min,json bundled minified output

Basic

> bundle basic/schema.json
{
	... bundle specification
}

Output folder specified

> bundle basic/schema.json dist
Bundling: api.json
Writing output to: dist/schema.json

Output file specified

> bundle basic/schema.json basic/schema.dist.json
Bundling: api.json
Writing output to: basic/schema.dist.json

Bundle compression

> bundle basic/schema.json --compress
{... specification without whitespace ...}

Framework integrations

Starburst

To add this command to starburst-cli just add OpenApiBundleBootstrap to your bootstrap config.

When using this with starburst you can add BundleConfig to your di to change the default values for the bundle command

Contribute

We are always happy to receive bug/security reports and bug/security fixes

License

The MIT License (MIT). Please see License File for more information.