northwoods / openapi
用于处理 OpenAPI 规范的工具
0.1.0
2018-11-20 16:48 UTC
Requires
- php: ^7.2
Requires (Dev)
- phpstan/phpstan: ^0.10.5
- phpstan/phpstan-phpunit: ^0.10.0
- phpunit/phpunit: ^7.3
- squizlabs/php_codesniffer: ^3.3
This package is auto-updated.
Last update: 2024-09-21 20:51:31 UTC
README
用于处理 OpenAPI 规范的工具。
安装
安装和使用此包的最佳方式是使用 composer
composer require northwoods/openapi
使用
转换
此包支持将 OpenAPI 架构转换为 JSON Schema 正确格式
use Northwoods\OpenApi\Converter; // See below for options $converter = new Converter($options); /** @var object */ $schema = /* load your schema */; $schema = $converter->convert($schema);
请注意,引用不会被解析,并且只能转换架构。建议与 justinrainbow/json-schema 一起使用。
选项
以下选项可用
boolean removeReadOnly
删除所有具有readOnly = true
的架构boolean removeWriteOnly
删除所有具有writeOnly = true
的架构string[] keepUnsupported
不要删除这些架构属性
致谢
转换器基于优秀的 openapi-to-json-schema 包。类型/格式转换受 此 PHP 端口 影响。