Challenge - 5 Problems
JSON Schema Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the result of this JSON Schema validation?
Given this JSON Schema and JSON data, what will Postman report after validation?
Postman
{
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer", "minimum": 18}
},
"required": ["name", "age"]
}
Data:
{
"name": "Alice",
"age": 17
}Attempts:
2 left
💡 Hint
Check the 'minimum' constraint for the 'age' property.
✗ Incorrect
The schema requires 'age' to be an integer with a minimum value of 18. The data has 'age' as 17, which is below the minimum, so validation fails.
❓ assertion
intermediate2:00remaining
Which assertion correctly validates the JSON response schema in Postman?
You want to assert that the response JSON has a 'status' string and an 'items' array. Which Postman test script assertion is correct?
Postman
const schema = {
type: 'object',
properties: {
status: { type: 'string' },
items: { type: 'array' }
},
required: ['status', 'items']
};Attempts:
2 left
💡 Hint
The schema variable must be passed as an object, not a string or empty.
✗ Incorrect
Option B correctly passes the schema object to the jsonSchema assertion. Other options pass invalid arguments causing errors or false positives.
🔧 Debug
advanced2:00remaining
Why does this JSON Schema validation fail unexpectedly?
This schema expects a property 'email' as a string with format 'email'. The data has a valid email string. Why does validation fail?
Postman
{
"type": "object",
"properties": {
"email": {"type": "string", "format": "email"}
},
"required": ["email"]
}
Data:
{
"email": "user@example.com"
}Attempts:
2 left
💡 Hint
Check Postman's support for JSON Schema format validation.
✗ Incorrect
Postman's JSON Schema validator does not enforce 'format' keywords like 'email', so it may ignore them but does not cause failure. This causes unexpected validation failure only if relying on format enforcement.
🧠 Conceptual
advanced2:00remaining
What is the main purpose of JSON Schema validation in API testing?
Choose the best explanation for why testers use JSON Schema validation in Postman or similar tools.
Attempts:
2 left
💡 Hint
Think about what JSON Schema describes.
✗ Incorrect
JSON Schema validation checks the shape and data types of JSON responses to ensure they meet the expected contract.
❓ framework
expert3:00remaining
How to implement JSON Schema validation in a Postman test script for nested objects?
Given this schema with nested objects, which Postman test script correctly validates the response?
Postman
const schema = {
type: 'object',
properties: {
user: {
type: 'object',
properties: {
id: { type: 'integer' },
profile: {
type: 'object',
properties: {
email: { type: 'string' },
active: { type: 'boolean' }
},
required: ['email', 'active']
}
},
required: ['id', 'profile']
}
},
required: ['user']
};Attempts:
2 left
💡 Hint
Pass the full schema object to the assertion, not parts of it.
✗ Incorrect
The jsonSchema assertion expects the full schema object. Passing nested parts will cause validation errors or incorrect checks.