Skip to content

[Feature] API Response body & schema validations #21561

Closed

Description

Let us know what functionality you'd like to see in Playwright and what your use case is.

I want to be able to validate an api response body matches a provided schema.json file. I know that it can be done using external libraries in TypeScript (or any other language binding) but it makes sense for playwright to have this as a built-in feature (as well as validating the entire body content not just extracting values from it).

Do you think others might benefit from this as well?

YES! Anyone who does API Test Automation will definitely need to validate the response body content against a file, and the response schema as well.

Activity

  1. pavelfeldman commented on Sep 8, 2025

    @pavelfeldman
    Member

    Why was this issue closed?

    Thank you for your involvement. This issue was closed due to limited engagement (upvotes/activity), lack of recent activity, and insufficient actionability. To maintain a manageable database, we prioritize issues based on these factors.

    If you have additional information not present in this issue that you think will help prioritizing it, please open a new issue and reference this one. More support or clarity on its necessity may prompt a review. Your understanding and cooperation are appreciated.

  2. hariprasathvs commented on Nov 21, 2025

    @hariprasathvs

    Hi Playwright team,
    I would like to contribute built-in schema validation support for API testing.

    My Proposal
    Use AJV as the validation engine (industry standard, well-maintained)
    Implement as a built-in fixture similar to request
    Support JSON Schema, Open API 3 and Swagger 2 formats.
    Provide clear error messages in the test reports.

    I have already did a similar kind of implementation in cypress in one of my project and I am happy to submit a PR if this aligns with Playwright's direction. Would love to hear your thoughts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions