You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, up to **20** validation errors are reported per response. You can change this via the constructor:
150
+
151
+
```php
152
+
// Report up to 5 errors
153
+
$validator = new OpenApiResponseValidator(maxErrors: 5);
154
+
155
+
// Report all errors (unlimited)
156
+
$validator = new OpenApiResponseValidator(maxErrors: 0);
157
+
158
+
// Stop at first error (original behavior)
159
+
$validator = new OpenApiResponseValidator(maxErrors: 1);
160
+
```
161
+
162
+
For Laravel, set the `max_errors` key in `config/openapi-contract-testing.php`.
163
+
143
164
## Coverage Report
144
165
145
166
After running tests, the PHPUnit extension prints a coverage report:
@@ -211,9 +232,12 @@ The package auto-detects the OAS version from the `openapi` field and handles sc
211
232
212
233
Main validator class. Validates a response body against the spec.
213
234
235
+
The constructor accepts a `maxErrors` parameter (default: `20`) controlling how many schema errors are collected before stopping. Use `0` for unlimited, `1` to stop at the first error.
236
+
214
237
The optional `responseContentType` parameter enables content negotiation: when provided, non-JSON content types (e.g., `text/html`) are checked for spec presence only, while JSON-compatible types proceed to full schema validation.
215
238
216
239
```php
240
+
$validator = new OpenApiResponseValidator(maxErrors: 20);
0 commit comments