paveljanda / php-openapi-specificaion-expander
Script that recursively expands references in OpenAPI specification
v3.0.1
2019-11-27 15:05 UTC
Requires
- php: ^7.3
Requires (Dev)
- gamee/php-code-checker-rules: ^1.0
- ninjify/coding-standard: ^0.9.0
This package is auto-updated.
Last update: 2024-11-28 03:21:44 UTC
README
paveljanda/php-openapi-specificaion-expander
This tool let's you expand recursively definitions in open api specifiation (JSON/YAML)
Installation
composer require paveljanda/php-openapi-specificaion-expander
Example - YAML
require __DIR__ . '/vendor/autoload.php'; use PavelJanda\OpenAPIExpander\OpenAPIExpander; use Symfony\Component\Yaml\Yaml; $specData = Yaml::parseFile(__DIR__ . '/openapiv3.yaml'); $expandedData = (new OpenAPIExpander)->expand($specData); echo Yaml::dump($expandedData, 100, 2);
Example - JSON
require __DIR__ . '/vendor/autoload.php'; use PavelJanda\OpenAPIExpander\OpenAPIExpander; $specData = json_decode(file_get_contents(__DIR__ . '/openapiv3.json')); $expandedData = (new OpenAPIExpander)->expand($specData); echo json_encode($expandedData, JSON_PRETTY_PRINT);