Uploaded December 2025 | Updated November 2026, 6 hours ago
Check out schema validation bundled with apiRequest in @seontechnologies/playwright-utils
API checks usually come from two extremes;
- assert everything with huge, brittle assertion walls
- assert almost nothing (status and maybe one other thing); green tests that don’t really validate contracts
1 - One API, all 3 JS ecosystem schema types
Zod, JSON Schema (AJV), and OpenAPI (JSON/YAML) through the same .validateSchema() API
2. Contract + intent checks without extra code
The full schema gets validated, while the explicit checks stay minimal.
Simple “shape” assertions for what you care about
or predicate functions for richer intent checks (think @gleb 's awesome cy.spok-style predicates + @SebastianClavijoSuero 's schema checks combined, but less code because the schema already covers the full contract)
3. Two modes: fluent vs “decoupled”
Fluent chaining when your API + schema are aligned
await apiRequest(...).validateSchema(schema, { shape: ... })
Awaited helper/fixture when schemas lag behind reality: run the API call first, then validate the response separately using the exact same validation engine (easier adoption in messy orgs)
await apiRequest({res, ...)
await validateSchema(schema, res, { shape: ... })
4. UI mode: the schema validation results with apiRequest in the same UI
Bonus:
Schema-only mode: for when you just want contract compliance and minimal test noise, or you want to isolate tests and schema checks.
Non-throwing “return mode”, so that you can report validation failures without failing immediately (useful for “schema lags behind reality” orgs, or gradual adoption).
Optional peer dependencies so you only install the validators you actually use.
docs: github.com/seontechnologies/playwright-utils/blob/main/docs/api-request.md
#playwright #testautomation #api #schemavalidation #zod #openapi #jsonschema #qualityengineering
Check out schema validation bundled with apiRequest in @seontechnologies/playwright-utils
API checks usually come from two extremes;
- assert everything with huge, brittle assertion walls
- assert almost nothing (status and maybe one other thing); green tests that don’t really validate contracts
1 - One API, all 3 JS ecosystem schema types
Zod, JSON Schema (AJV), and OpenAPI (JSON/YAML) through the same .validateSchema() API
2. Contract + intent checks without extra code
The full schema gets validated, while the explicit checks stay minimal.
Simple “shape” assertions for what you care about
or predicate functions for richer intent checks (think @gleb 's awesome cy.spok-style predicates + @SebastianClavijoSuero 's schema checks combined, but less code because the schema already covers the full contract)
3. Two modes: fluent vs “decoupled”
Fluent chaining when your API + schema are aligned
await apiRequest(...).validateSchema(schema, { shape: ... })
Awaited helper/fixture when schemas lag behind reality: run the API call first, then validate the response separately using the exact same validation engine (easier adoption in messy orgs)
await apiRequest({res, ...)
await validateSchema(schema, res, { shape: ... })
4. UI mode: the schema validation results with apiRequest in the same UI
Bonus:
Schema-only mode: for when you just want contract compliance and minimal test noise, or you want to isolate tests and schema checks.
Non-throwing “return mode”, so that you can report validation failures without failing immediately (useful for “schema lags behind reality” orgs, or gradual adoption).
Optional peer dependencies so you only install the validators you actually use.
docs: github.com/seontechnologies/playwright-utils/blob/main/docs/api-request.md
#playwright #testautomation #api #schemavalidation #zod #openapi #jsonschema #qualityengineering










