An open API service indexing awesome lists of open source software.

https://github.com/atoum/json-schema-extension

The atoum json-schema-extension allows you to validate JSON against schemas.
https://github.com/atoum/json-schema-extension

Last synced: 19 days ago
JSON representation

The atoum json-schema-extension allows you to validate JSON against schemas.

Awesome Lists containing this project

README

        

# atoum/json-schema-extension [![Build Status](https://travis-ci.org/atoum/json-schema-extension.svg?branch=master)](https://travis-ci.org/atoum/json-schema-extension)

This extension validates your JSON strings against a JSON-Schema [specification](http://json-schema.org/).

It also checks if a string a valid JSON string.

## Example

```php
given($string = '{"foo": "bar"}')
->then
->json($string)
;
}

public function testValidatesSchema()
{
$this
->given($string = '["foo", "bar"]')
->then
->json($string)->validates('{"title": "test", "type": "array"}')
->json($string)->validates('/path/to/json.schema')
;
}
}
```

## Install it

Install extension using [composer](https://getcomposer.org):

```
composer require --dev atoum/json-schema-extension
```

Enable the extension using atoum configuration file:

```php
addExtension(new jsonSchema\extension($script));
```

## Links

* [atoum](http://atoum.org)
* [atoum's documentation](http://docs.atoum.org)
* [JSON-Schema specification](http://json-schema.org/)

## License

json-schema-extension is released under the BSD-3-Clause License. See the bundled [LICENSE](LICENSE) file for details.

![atoum](http://atoum.org/images/logo/atoum.png)