定制 membrane/openapi-reader 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

membrane/openapi-reader

最新稳定版本:3.0.0

Composer 安装命令:

composer require membrane/openapi-reader

包简介

README 文档

README

This library is intended to be used in conjunction with other Membrane libraries.

It wraps the php-openapi library with some additional validation, including Membrane-specific requirements.

Requirements

Installation

composer require membrane/openapi-router

Quick Start

Instantiate a Reader

$versions = [\Membrane\OpenAPIReader\OpenAPIVersion::Version_3_0];

$reader = new \Membrane\OpenAPIReader\Reader($versions);

Read From An Absolute File Path

This method is the main use-case of the reader and is capable of resolving all references.

If your file path contains the file extension then the reader can use this to determine which language the OpenAPI is written in.

// code to instantiate reader... 

$reader->readFromAbsoluteFilePath('~/path/to/my-openapi.yaml');

Otherwise, you may ensure it reads the file as a specific format by providing a second argument:

// code to instantiate reader... 

$fileFormat = \Membrane\OpenAPIReader\FileFormat::Json;

$reader->readFromAbsoluteFilePath('my-openapi', $fileFormat);

Read From A String

This method is only capable of resolving Reference Objects, it cannot resolve references to Relative Documents .

Because the OpenAPI will be read from a string, the FileFormat MUST be provided.

// code to instantiate reader... 

$myOpenAPI = '<Insert your OpenAPI Spec here>';
$fileFormat = \Membrane\OpenAPIReader\FileFormat::Json;

$reader->readFromString($myOpenAPI, $fileFormat)

统计信息

  • 总下载量: 13.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MPL-2.0
  • 更新时间: 2023-09-06