JSON Schema Validation: How to Validate JSON Schema with Postman?
What is JSON?
- JSON stands for JavaScript Object Notation
- JSON is a lightweight format for storing and transporting data
- JSON is often used when data is sent from a server to a web page
- JSON is "self-describing" and easy to understand
What JSON Schema?
JSON Schema is a contract for your JSON document that defines the expected data types and format of each field in the response
Why JSON Schema Validation required?
Using JSON Schema to construct a model of your API response makes it easier to validate your API is returning the data is should.Monitor your API responses, ensuring they adhere to a specified format.
Get alerted when breaking changes occur.
In this video, I have covered How to do JSON Schema Validation in Postman Step by Step?
Generate JSON Schema : https://jsonschema.net/#/
Object Assertions and check REQD Properties. We do this so that every element in the JSON becomes mandatory.
Number Assertions and check Use number, not integer for all numeric instances
Configure and Test using Postman, Tiny Validator for JSON Schema v4. Use json-schema draft v4 to validate simple values and complex objects using a rich validation vocabulary - https://github.com/geraintluff/tv4
Notes about JSON Schema Validation - https://dynalist.io/d/eDFZUS1L8emTU5B
JSON Schema Documentation - http://json-schema.org/
API Used - https://reqres.in/api/users/2
JSON Schema Creator Tool - https://jsonschema.net/
More About Tiny Validator - http://geraintluff.github.io/tv4/