abacaphiliac / zend-json-schema-validator
A ZF2 validator for justinrainbow/json-schema.
Installs: 59 014
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.6
- justinrainbow/json-schema: ^2.0
- zendframework/zend-json: ^3.0|^2.0
- zendframework/zend-validator: ^2.0
Requires (Dev)
- jakub-onderka/php-parallel-lint: ^0.9
- mikey179/vfsstream: ^1.6
- phing/phing: ^2.9
- phpunit/phpunit: ^5.4|^4.8
- squizlabs/php_codesniffer: ^2.2
This package is auto-updated.
Last update: 2024-11-05 08:37:24 UTC
README
abacaphiliac/zend-json-schema-validator
A ZF2 validator for justinrainbow/json-schema.
Installation
composer require abacaphiliac/zend-json-schema-validator
Usage
Use it inline:
$validator = new \Abacaphiliac\Zend\Validator\JsonSchema(array(
'file' => '/path/to/your/schema.json',
));
if (!$validator->isValid('{"Foo":"Bar"}')) {
$validationMessages = $validator->getMessages();
}
Hook it up to an Apigility input-filter-spec:
return array(
'input_filter_specs' => array(
'YourApi\\V1\\Rest\\YourService\\Validator' => array(
array(
'name' => 'YourJsonParam',
'validators' => array(
array(
'name' => 'IntegrationConfiguration\\Validator\\JsonSchema',
'options' => array(
'file' => dirname(dirname(dirname(__DIR__))) . '/config/json-schema/IntegrationConfiguration/V1/Rest/OutboundDocumentation/configurations-config.json',
),
),
)
),
),
),
);
Dependencies
See composer.json.
Contributing
composer update && vendor/bin/phing
This library attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.