Commit bdb6198
feat: add OpenAPI schema validation using Schemathesis (#19)
* fix: remove method from kwargs and mark tests as ERROR on exceptions
- Remove 'method' from kwargs before passing to auth.request() to fix 'got multiple values' error
- Set test status to ERROR when exceptions occur during test execution
- Fixes issue where all 190 tests were failing but showing as passed
* fix: remove url parameter from kwargs to prevent duplication
The case.as_transport_kwargs() method returns a dictionary that includes
both 'method' and 'url' keys. We already fixed the 'method' duplication
in the previous commit, but 'url' was also causing the same issue.
When we pass path as a positional argument to auth.request(), which then
passes it to httpx.Client.request() as the 'url' parameter, having 'url'
also in **kwargs causes 'got multiple values for argument url' error.
This fix removes both 'method' and 'url' from kwargs before passing to
auth.request() to prevent parameter duplication.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* fix: handle OperationDefinition object in Schemathesis 4.x response validation
In Schemathesis 4.x, operation.definition is an OperationDefinition object,
not a dictionary. The code was calling .get() on it which caused AttributeError.
This fix makes _check_response() defensive by:
1. Checking if definition is a dict or object
2. Accessing responses as dict.get() or object.responses
3. Wrapping in try-except to handle unexpected structures gracefully
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat: add OpenAPI schema validation using Schemathesis
Enhanced response validation to use Schemathesis's built-in schema validation
via case.validate_response(). This will detect discrepancies between API
responses and the OpenAPI specification including:
- Missing required fields
- Wrong field types
- Invalid enum values
- Schema constraint violations
- Additional properties not defined in spec
When validation fails, the error is captured as a Discrepancy with:
- Type: CONSTRAINT_MISMATCH
- Constraint: schema_validation
- Details: The specific validation error from Schemathesis
This should now detect the discrepancies that were found in local testing.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent b9df2ca commit bdb6198
1 file changed
+20
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
231 | 250 | | |
232 | 251 | | |
233 | 252 | | |
| |||
0 commit comments