goez/apib-unit

API-Blueprint 单元测试助手

2.0.0 2022-06-07 10:16 UTC

This package is auto-updated.

Last update: 2024-09-07 15:12:55 UTC


README

安装

  • 安装 Drafter.
  • 将包添加到 composer
$ composer require goez/apib-unit --dev

用法

// Parse API-Blueprint document, and get the endpoints.
$endpoints = (new Apib('./example.apib'))->getEndpoints();

// Get first endpoints
$endpoint = $endpoints[0];

// Get first example of the endpoint
$example = $endpoint->getExamples()[0];

// Get request of example
$request = $example->getRequests()[0];

// Get response of example
$response = $example->getResponse()[0];

// Get JSON Schema of response
$schema = $response->getSchema();

许可证

MIT