Download the PHP package radebatz/openapi-verifier without Composer
On this page you can find all versions of the php package radebatz/openapi-verifier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download radebatz/openapi-verifier
More information about radebatz/openapi-verifier
Files in radebatz/openapi-verifier
Package openapi-verifier
Short Description Verify JSON (api response) against OpenAPI specification.
License MIT
Homepage http://radebatz.net/mano/
Informations about the package openapi-verifier
openapi-verifier
Introduction
Allows to validate a controller response from your API project against a given OpenAPI specification.
Requirements
Installation
You can use composer or simply download the release.
Composer
The preferred method is via composer. Follow the installation instructions if you do not already have composer installed.
Once composer is installed, execute the following command in your project root to install this library:
After that all required classes should be availabe in your project to add routing support.
Usage
Manual verification
The VerifiesOpenApi
trait can be used directly and customized in 3 ways in order to provide the reqired OpenApi specifications:
- Overriding the method
getOpenApiSpecificationLoader()
as shown below - Populating the
$openapiSpecificationLoader
property. - Creating a property
$openapiSpecification
pointing to the specification file
Laravel adapter
The adapter will try to resolve the specification dynamically in this order:
- filename passed into
registerOpenApiVerifier()
/tests/openapi.json
/tests/openapi.yaml
- Generate specification from scratch by scanning the
app
folder
The code expects to be in the context of a Laravel Test\TestCase
.
Slim adapter
The adapter will try to resolve the specification dynamically in this order:
- filename passed into
registerOpenApiVerifier()
/tests/openapi.json
/tests/openapi.yaml
- Generate specification from scratch by scanning the
src
folder
Simplest way is to register the verifier in the Tests\Functional\BaseTestCase
.
License
The openapi-verifier project is released under the MIT license.
All versions of openapi-verifier with dependencies
ext-json Version *
justinrainbow/json-schema Version ^5.2.13
nyholm/psr7 Version ^1.1
nyholm/psr7-server Version ^1.0
psr/http-message Version ^2.0
symfony/psr-http-message-bridge Version ^6.0