schema Validation in Playwright, done right with playwright-utils: Zod / JSON Schema / OpenAPI @MuratKeremOzcan
schema Validation in Playwright, done right with playwright-utils: Zod / JSON Schema / OpenAPI  @MuratKeremOzcan
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
schema Validation in Playwright, done right with playwright-utils: Zod / JSON Schema / OpenAPIMurat Reviews Your Tests in CI | BMad TeA Test ReviewapiRequest from playwright-utils: better than SuperTest for CI with Playwright Trace + a Real UIherdr stacked prs quality systemHow to always get Pact Webhook setup correctpw utils bmad demoa pattern to fine tune cy task when handling multiple argumentsCodeRabbit PR reviewsSmart Test Burn-In from @seontechnologies/playwright-utils: Kill flakey tests before they hit mainPactJs breaking change demoBMAD method (v6) Chatgpt customGpt demoBMad test architect documentation demo
Murat Ozcan |

schema Validation in Playwright, done right with playwright-utils: Zod / JSON Schema / OpenAPI

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER