New PLAYWRIGHT-AJV-SCHEMA-VALIDATOR for API Testing!

Published on April 8, 2025

(Cover image from pexels.com by RealToughCandy.com)

Fellow QAs, the moment you’ve been waiting for is finally here!!! I am beyond thrilled to introduce the groundbreaking PLAYWRIGHT-AJV-SCHEMA-VALIDATOR plugin! 🚀 💥

Image description

 

What is it?

This brand-new Playwright plugin takes API schema validation to the next level. Whether you're dealing with plain JSON Schema or OpenAPI/Swagger schema documents, this plugin simplifies the process by presenting clear, user-friendly validation results directly within Playwright UI, Trace Viewer, and HTML Reports. Debugging schema issues has never been easier!

Here’s what makes PLAYWRIGHT-AJV-SCHEMA-VALIDATOR truly game-changing:

  • ⚡ By simply providing the endpoint, HTTP method, and expected status, it automatically extracts the correct schema from your entire OpenAPI3 or Swagger2 document—no manual effort needed!

  • 🔗 It integrates seamlessly with PW-API-PLUGIN (pwApi and pwAxios classes) but can also function independently with Playwright’s standard API requests (e.g., request.get()).

 

Main Features

  • 📊 Detailed insights with the number of schema errors.

  • ❌ A full list of validation errors (as provided by Ajv).

  • 👁️‍🗨️ A view of the validated data, directly pinpointing where the errors occur in the result data and detailing what those errors are.

Schema Validation Pass

Image description

Schema Validation Fail Using pw-api-plugin

Image description

Schema Validation Fail Using Playwright Standard API request

Image description

Schema Validation Fails with Custom Styles Used in your Tests

Image description

Disable Schema Validation

Setting environment variable DISABLE_SCHEMA_VALIDATION to "true".

Image description

Attach Schema Validation Failure Details in HTML Report

Setting environment variable LOG_API_REPORT to "true".

Schema Validation Test Results in HTML Report

Image description

Schema Validation Failure Details in HTML Report

Image description

Schema Validation Details in Trace Viewer

Executing command npx playwright test --trace on.

Schema Validation Details in Trace Viewer - Using pw-api-plugin

Image description

Schema Validation Details in Trace Viewer - Using Playwright Standard API request

Image description

 

Where to find it?

Here are the links to the plugin:

 

At the core!

The plugin leverages the brand-new CORE-AJV-SCHEMA-VALIDATOR, which I have just released!

This powerful engine drives not only this Playwright plugin but also its counterpart the CYPRESS-AJV-SCHEMA-VALIDATOR plugin. You can use CORE-AJV-SCHEMA-VALIDATOR directly in any project or as the core engine for these advanced plugins.

💡 Fun fact: CYPRESS-AJV-SCHEMA-VALIDATOR was featured in the Cypress blog’s Elevate Your Cypress Testing: Top 10 Essential Plugins—and now, Playwright users can enjoy the same cutting-edge capability!

 

So.. now you Know!

Elevate your Playwright API testing experience with PLAYWRIGHT-AJV-SCHEMA-VALIDATOR + PW-API-PLUGIN, and exterminate API bugs like the "Baba Yaga" of the QA underworld! 💪 😎

Cheers to bug-free APIs and effortless schema validation.

I'd love to hear from you! Please don't forget to follow me, leave a comment, or a reaction if you found this article useful or insightful. ❤️ 🦄 🤯 🙌 🔥

If you like this plugin, please don’t forget to:
⭐ Star the project
📣 Promote it on social media
📄 Refer to this project in your project’s README
🗣️ Mention it at local meetups, and tell your friends/colleagues.

☕ Or, if you’re feeling extra generous, you can even buy me a coffee or contribute to a training session so I can keep learning and sharing cool stuff with all of you!

Thank you for your support!
Buy Me A Coffee

You can also connect with me on my new YouTube channel: https://www.youtube.com/@SebastianClavijoSuero