Validating a schema has all the right properties and nothing more

Hi, my schema:

    "data": {
        "me": {
            "firstName": "David",
            "lastName": "Robert",
            "myNumber": "ZZ",
            "myBranch": {
                "cCode": "GB",
                "eNumber": "3089800"
            "myAccount": {
                "contactId": "000AAA111"

I’ve previously written the test for others schemas like so:

// schema
const schema = {
    "type": "object",
    "properties": {
        "id": { "type": "string" },
        "tel":{ "type":"number" },
        "position":{ "type":"string" }
        "required": [

pm.test("Schema should be valid", () => {;

But I’ve tried various ways but I can’t seem to modify the test I’ve written previously to suit the new schema objects and properties that are at different levels?! what’s the best way to do it? various levels?!

Hi @thingmie

You could try this online JSON to JSON Schema tool, to try and create a JSON Schema that matches your example;

Perfect, thanks a lot.