Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need Help: how to get all validation errors at once? #207

Open
universalex opened this issue Aug 24, 2023 · 1 comment
Open

Need Help: how to get all validation errors at once? #207

universalex opened this issue Aug 24, 2023 · 1 comment

Comments

@universalex
Copy link

Hi all,
i have a routedRequestValidator for a yaml file and a prepared body to check against the specs before actually making the request.

$validator = (new ValidatorBuilder())->fromYamlFile($specFile)->getRoutedRequestValidator();
$validator->validate(new OperationAddress('/create/thing', 'post'), $request);

Sure there might be validation errors because the body does not match the schema. Now the SchemaMismatch Exception is raised within the SchemaValidator at the first occurence of a mismatched field. Is there a way to supply my own error handler so i can get all ValidationFailed-Exceptions at once?

Right now i have to check the body - resolve the issue, check again - resolve the ...

Any help would be appreciated!

Kind regards
Alex

@sidux
Copy link
Contributor

sidux commented Aug 23, 2024

I had the same issue and ended up forking the lib to add this feature, here is the fork https://github.com/sidux/openapi-psr7-validator
feel free to improve on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants