A lightweight package (v1.0.0, released 2024) for API testing that validates JSON responses against plain JSON schemas, Swagger 2.0, or OpenAPI 3 documents using the Ajv validator (v8.17.1+). It extracts the correct schema for a given endpoint method and status from complex API documents, providing both raw Ajv errors and user-friendly mismatch reports. Differentiates from bare Ajv by handling full OpenAPI/Swagger documents and simplifying setup for test frameworks like Cypress and Playwright.
npm install core-ajv-schema-validatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of validateSchema with a plain JSON schema and logging result.
Not configurable; consider wrapping the function or using a custom validation approach.
Run npm install ajv@latest ajv-formats@latest
Always provide a valid path object with endpoint and method.
npm install ajv-formats && addFormats(ajv) before using validateSchema
Provide a path object: { endpoint: '/users', method: 'get', status: 200 }Ensure schema is a valid JSON object (not a string or undefined).