How can I validate that each item in my Postman schema has a unique key?

Viewed 18

I'm using the built-in TinyValidator schema validation logic for Postman. Let's say that my API returns a list of objects:

const schema = {
  type: 'object',
  properties: {
    id:    { type: 'number' },
    name:  { type: 'string' }
  },
  required: ['id', 'name']
}
  1. How can I require that each id be unique in the returned JSON array?
  2. How would I achieve the same thing in what I gather is the more modern Postman validation framework?
0 Answers
Related