Schema Validation Using Postman and Newman

This quick read will help in understanding :

  1. Problem Statement
  2. What is schema testing
  3. Why do we need schema testing
  4. How postman collections and Newman can help with schema validation
  5. Example Repository
  1. Problem Statement

Contract or Schema changes in Microservice world

2. What is schema testing

Schema is a contract for document that defines the expected data types and format of each field in the response.

In the below example JSON object is the response from some api and we have corresponding JSON Schema just below it. So if the expected schema matches the actual schema, test is pass.

Create schemas from here- .

3. Why do we need schema testing?

In Distributed Microservice world we face frequent contract change challenge between consumer-service and provider-service. Best solution for the issue is Consumer Driven Contract Test which can be achieved by using PACT or Spring Cloud Contract.

Quick read on Spring Cloud Contract-

Above solution will work only when producer and consumer repository access is available. But in majority scenarios producer doesn’t allow any changes in their repository.
So we can only check on consumer side to verify if the producer is adhering to the agreed communication schema. Postman Collection and Newman can help here.

4. How postman collections and Newman can help with schema validation


  • Quick Setup
  • We monitor API responses and ensure that the format that we are getting is same as the expected one.
  • We get alert whenever there is any breaking change in JSON response.
  • Some confidence if CDC — Consumer Driven Contract is not implemented.


  • Its more of the check on schema than solution
  • We are not checking consumer side schema update. So regular maintenance is required
  • Feedback is late compared to Consumer Driven Contract

5. Example Repository

Please take a pull from


This document describes a way of how you can use postman collection with newman to perform schema validation.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store