File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010use Studio \OpenApiContractTesting \OpenApiCoverageTracker ;
1111use Studio \OpenApiContractTesting \OpenApiResponseValidator ;
1212
13+ use function is_int ;
1314use function is_string ;
1415use function str_contains ;
1516use function strtolower ;
@@ -51,7 +52,10 @@ protected function assertResponseMatchesOpenApiSchema(
5152
5253 $ contentType = $ response ->headers ->get ('Content-Type ' , '' );
5354
54- $ validator = new OpenApiResponseValidator ();
55+ $ maxErrors = config ('openapi-contract-testing.max_errors ' , 20 );
56+ $ validator = new OpenApiResponseValidator (
57+ maxErrors: is_int ($ maxErrors ) ? $ maxErrors : 20 ,
58+ );
5559 $ result = $ validator ->validate (
5660 $ specName ,
5761 $ resolvedMethod ,
Original file line number Diff line number Diff line change 44
55return [
66 'default_spec ' => '' ,
7+
8+ // Maximum number of validation errors to report per response.
9+ // 0 = unlimited (reports all errors).
10+ 'max_errors ' => 20 ,
711];
You can’t perform that action at this time.
0 commit comments