https://github.com/softonic/openapi-validation-formats-extension
This library adds some format validation for OpenAPI validation middleware package.
https://github.com/softonic/openapi-validation-formats-extension
Last synced: about 1 year ago
JSON representation
This library adds some format validation for OpenAPI validation middleware package.
- Host: GitHub
- URL: https://github.com/softonic/openapi-validation-formats-extension
- Owner: softonic
- License: other
- Created: 2019-07-01T15:20:01.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-10T08:43:25.000Z (over 6 years ago)
- Last Synced: 2025-03-24T19:39:57.719Z (about 1 year ago)
- Language: PHP
- Size: 17.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
OpenApi validation formats extension
=====
[](https://github.com/softonic/openapi-validation-formats-extension/releases)
[](LICENSE.md)
[](https://travis-ci.org/softonic/openapi-validation-formats-extension)
[](https://scrutinizer-ci.com/g/softonic/openapi-validation-formats-extension/code-structure)
[](https://scrutinizer-ci.com/g/softonic/openapi-validation-formats-extension)
[](https://packagist.org/packages/softonic/openapi-validation-formats-extension)
[](http://isitmaintained.com/project/softonic/openapi-validation-formats-extension "Average time to resolve an issue")
[](http://isitmaintained.com/project/softonic/openapi-validation-formats-extension "Percentage of issues still open")
This library adds some format validation for [OpenAPI validation middleware](https://github.com/hkarlstrom/openapi-validation-middleware) package.
Installation
-------
Via composer:
```
composer require softonic/openapi-validation-formats-extension
```
Documentation
-------
Once installed you will be able to register the formats that you want from this package.
In this example we can see how to register the UUID format.
```
$validator = new OpenApiValidation(base_path() . '/swagger.json');
$validator->addFormat('string', 'uuid', new Uuid());
```
For more information about format registration refer to the [OpenAPI validation middleware](https://github.com/hkarlstrom/openapi-validation-middleware)
package [documentation](https://github.com/hkarlstrom/openapi-validation-middleware/blob/master/README.md).
Testing
-------
`softonic/openapi-validation-formats-extension` has a [PHPUnit](https://phpunit.de) test suite and a coding style compliance test suite using [PHP CS Fixer](http://cs.sensiolabs.org/).
To run the tests, run the following command from the project folder.
``` bash
$ docker-compose run tests
```
To run interactively using [PsySH](http://psysh.org/):
``` bash
$ docker-compose run psysh
```
License
-------
The Apache 2.0 license. Please see [LICENSE](LICENSE) for more information.
[PSR-2]: http://www.php-fig.org/psr/psr-2/
[PSR-4]: http://www.php-fig.org/psr/psr-4/