Last active
July 27, 2018 12:00
-
-
Save shrikantgond/39df3f4d3fcada078e4a6355aecd0979 to your computer and use it in GitHub Desktop.
Json Schema in Postman
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define the JSON Schema | |
const customerSchema = { | |
"required": ["id"], | |
"properties": { | |
"id": { | |
"type": "integer", | |
"minimum": 100, | |
"maximum": 1000 | |
}, | |
"name": { | |
"type": "string", | |
"minLength": 1, | |
"maxLength": 25 | |
} | |
} | |
}; | |
// Test whether the response matches the schema | |
var customer = JSON.parse(responseBody); | |
tests["Customer is valid"] = tv4.validate(customer, customerSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment