Unit Test Helper for API-Blueprint
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
src
tests
.gitignore
.phpunit-watcher.yml
README.md
composer.json
phpunit-printer.yml
phpunit.xml

README.md

Unit Test Helper for API-Blueprint

Installation

  • Install Drafter.
  • Add package to composer:
$ composer require goez/apib-unit --dev

Usage

// 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 = $examples[0]->getResponse()[0];

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

Example for Laravel API schema validating

License

MIT