{
"type":"object",
"properties":{
"items":{
"type":"array",
"items":{
"properties":{
"item_id":{
"type":"number"
},
"quantity":{
"type":"number"
},
"price":{
"type":"number"
},
"title":{
"type":"string"
},
"description":{
"type":"string"
}
},
"required":[
"item_id",
"quantity",
"price",
"title",
"description"
],
"additionalProperties":false
}
}
}
}
- Consider this scenario if you want to remove one object like the description from this scenario just simply remove it from the "required" array.
Source: Youtube
Video Title: JSON Schema Validation with REST-assured
Video URL: https://youtu.be/j6qFuLAPT3I
Query:
Aman Singh: Simple and helpful video...Thank you for the informative video.....but I had one doubt regarding arrays object in the schema...lets suppose the Json response which we have to generate the json schema has 2 objects in an array but the actual end-point is only returning one object value in that array then in that case the validation fails....but I am not sure if that should happen cause any array can varry but that should not change the schema defination....Please give your advice or thoughts on this....thanks again for the video!!!! @ProgramsBuzz