Skip to main content

Module request_validator

Module request_validator 

Source
Expand description

Request validation against OpenAPI spec.

Validates that conformance test requests (especially from HAR custom checks) conform to the OpenAPI specification: correct paths, required parameters, valid request body schemas, and matching content types.

Structs§

RequestViolation
A single request validation violation

Functions§

run_request_validation
Run request validation and write results to a file. Called from the conformance execution path.
validate_custom_checks
Validate custom conformance checks against an OpenAPI spec.
validate_emitted_requests
Round 44 (#79) — validate each emitted request retrospectively against the OpenAPI spec, after the bench run completes. Reads conformance-requests.json (which --export-requests writes) and emits one RequestViolation entry per actual wire-level rule break (enum, type, required field, etc.), so a user can see the client’s own view of what it sent that violated the contract without having to query the server’s /__mockforge/api/conformance/violations.
validate_emitted_requests_with_base_path
Round 45 (#79) — same as validate_emitted_requests but accepts an explicit base_path (e.g. Srikanth’s --base-path /api for the Apigee spec where every operation lives under /api/v1/... on the wire but /v1/... in the spec). Without it the emitted URL doesn’t match the spec path and every request silently skips validation.