elife / api-validator
eLife Sciences API validator
Installs: 19 185
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 12
Forks: 0
Open Issues: 1
Requires
- php: ^7.1 | ^8.0
- beberlei/assert: ^3.0
- guzzlehttp/psr7: ^1.7 | ^2.0
- justinrainbow/json-schema: ^5.3 | ^6.0
- psr/http-message: ^1.0
Requires (Dev)
- phpspec/phpspec: ^2.4 | ^7.0
- phpspec/prophecy: ^1.5
- phpunit/phpunit: ^6.5 | ^9.6
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-11-08 10:21:30 UTC
README
This library provides a validator for the eLife Sciences API.
It checks HTTP requests/responses to make sure that they match the specification. Currently only the body of the message is validated against the schema for that media type.
Dependencies
- Composer
- PHP 7
Installation
Execute composer require elife/api-validator:dev-master
.
Usage
To validate a message:
use eLife\ApiValidator\MessageValidator\JsonMessageValidator; use eLife\ApiValidator\SchemaFinder\PathBasedSchemaFinder; use JsonSchema\Validator; $messageValidator = new JsonMessageValidator(new PathBasedSchemaFinder('/path/to/api/schemas'), new Validator()); $messageValidator->validate($message);