Skip to content

v0.6

Choose a tag to compare

@osteel osteel released this 13 Jun 17:03
· 47 commits to main since this release
a480cc1

Breaking changes

Request and response validators merged

The request and response validators are now a single Validator class, and so are the validator builders:

// before
use Osteel\OpenApi\Testing\Response\ResponseValidatorBuilder;
use Osteel\OpenApi\Testing\Response\ResponseValidator;
use Osteel\OpenApi\Testing\Request\RequestValidatorBuilder;
use Osteel\OpenApi\Testing\Request\RequestValidator;

// now
use Osteel\OpenApi\Testing\ValidatorBuilder;
use Osteel\OpenApi\Testing\Validator;

As a result, validating request and response objects is now done by the same object and requires the same parameters:

$validator = ValidatorBuilder::fromYaml('my-definition.yaml')->getValidator();

$validator->validate($request, '/users', 'post');
$validator->validate($response, '/users', 'post');

Note that before these changes, validating a request only required the request object, with no parameters.

Pull requests

  • #8 Unified interface for both request and response validation