mafintosh / is-my-json-valid

A JSONSchema validator that uses code generation to be extremely fast
MIT License
965 stars 111 forks source link

Wrong result of a validation #75

Open pashoo2 opened 9 years ago

pashoo2 commented 9 years ago
var _schema = {
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "http://jsonschema.net",
  "type": "array",
  "items": [
    {
      "id": "http://jsonschema.net/0",
      "type": "object",
      "properties": {
        "_id": {
          "id": "http://jsonschema.net/0/_id",
          "type": "number"
        },
        "index": {
          "id": "http://jsonschema.net/0/index",
          "type": "integer"
        },
        "guid": {
          "id": "http://jsonschema.net/0/guid",
          "type": "number"
        },
        "isActive": {
          "id": "http://jsonschema.net/0/isActive",
          "type": "boolean"
        },
        "balance": {
          "id": "http://jsonschema.net/0/balance",
          "type": "string"
        },
        "picture": {
          "id": "http://jsonschema.net/0/picture",
          "type": "string"
        },
        "age": {
          "id": "http://jsonschema.net/0/age",
          "type": "integer"
        },
        "eyeColor": {
          "id": "http://jsonschema.net/0/eyeColor",
          "type": "string"
        },
        "name": {
          "id": "http://jsonschema.net/0/name",
          "type": "string"
        },
        "gender": {
          "id": "http://jsonschema.net/0/gender",
          "type": "string"
        },
        "company": {
          "id": "http://jsonschema.net/0/company",
          "type": "string"
        },
        "email": {
          "id": "http://jsonschema.net/0/email",
          "type": "string"
        },
        "phone": {
          "id": "http://jsonschema.net/0/phone",
          "type": "string"
        },
        "address": {
          "id": "http://jsonschema.net/0/address",
          "type": "string"
        },
        "about": {
          "id": "http://jsonschema.net/0/about",
          "type": "string"
        },
        "registered": {
          "id": "http://jsonschema.net/0/registered",
          "type": "string"
        },
        "latitude": {
          "id": "http://jsonschema.net/0/latitude",
          "type": "number"
        },
        "longitude": {
          "id": "http://jsonschema.net/0/longitude",
          "type": "number"
        },
        "tags": {
          "id": "http://jsonschema.net/0/tags",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/0/tags/0",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/0/tags/1",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/0/tags/2",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/0/tags/3",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/0/tags/4",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/0/tags/5",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/0/tags/6",
              "type": "string"
            }
          ]
        },
        "friends": {
          "id": "http://jsonschema.net/0/friends",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/0/friends/0",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/0/friends/0/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/0/friends/0/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/0/friends/1",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/0/friends/1/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/0/friends/1/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/0/friends/2",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/0/friends/2/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/0/friends/2/name",
                  "type": "string"
                }
              }
            }
          ]
        },
        "greeting": {
          "id": "http://jsonschema.net/0/greeting",
          "type": "string"
        },
        "favoriteFruit": {
          "id": "http://jsonschema.net/0/favoriteFruit",
          "type": "string"
        }
      },
      "required": [
        "_id",
        "index",
        "guid",
        "isActive",
        "balance",
        "picture",
        "age",
        "eyeColor",
        "name",
        "gender",
        "company",
        "email",
        "phone",
        "address",
        "about",
        "registered",
        "latitude",
        "longitude",
        "tags",
        "friends",
        "greeting",
        "favoriteFruit"
      ]
    },
    {
      "id": "http://jsonschema.net/1",
      "type": "object",
      "properties": {
        "_id": {
          "id": "http://jsonschema.net/1/_id",
          "type": "string"
        },
        "index": {
          "id": "http://jsonschema.net/1/index",
          "type": "integer"
        },
        "guid": {
          "id": "http://jsonschema.net/1/guid",
          "type": "string"
        },
        "isActive": {
          "id": "http://jsonschema.net/1/isActive",
          "type": "boolean"
        },
        "balance": {
          "id": "http://jsonschema.net/1/balance",
          "type": "string"
        },
        "picture": {
          "id": "http://jsonschema.net/1/picture",
          "type": "string"
        },
        "age": {
          "id": "http://jsonschema.net/1/age",
          "type": "integer"
        },
        "eyeColor": {
          "id": "http://jsonschema.net/1/eyeColor",
          "type": "string"
        },
        "name": {
          "id": "http://jsonschema.net/1/name",
          "type": "string"
        },
        "gender": {
          "id": "http://jsonschema.net/1/gender",
          "type": "string"
        },
        "company": {
          "id": "http://jsonschema.net/1/company",
          "type": "string"
        },
        "email": {
          "id": "http://jsonschema.net/1/email",
          "type": "string"
        },
        "phone": {
          "id": "http://jsonschema.net/1/phone",
          "type": "string"
        },
        "address": {
          "id": "http://jsonschema.net/1/address",
          "type": "string"
        },
        "about": {
          "id": "http://jsonschema.net/1/about",
          "type": "string"
        },
        "registered": {
          "id": "http://jsonschema.net/1/registered",
          "type": "string"
        },
        "latitude": {
          "id": "http://jsonschema.net/1/latitude",
          "type": "number"
        },
        "longitude": {
          "id": "http://jsonschema.net/1/longitude",
          "type": "number"
        },
        "tags": {
          "id": "http://jsonschema.net/1/tags",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/1/tags/0",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/1/tags/1",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/1/tags/2",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/1/tags/3",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/1/tags/4",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/1/tags/5",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/1/tags/6",
              "type": "string"
            }
          ]
        },
        "friends": {
          "id": "http://jsonschema.net/1/friends",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/1/friends/0",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/1/friends/0/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/1/friends/0/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/1/friends/1",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/1/friends/1/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/1/friends/1/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/1/friends/2",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/1/friends/2/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/1/friends/2/name",
                  "type": "string"
                }
              }
            }
          ]
        },
        "greeting": {
          "id": "http://jsonschema.net/1/greeting",
          "type": "string"
        },
        "favoriteFruit": {
          "id": "http://jsonschema.net/1/favoriteFruit",
          "type": "string"
        }
      }
    },
    {
      "id": "http://jsonschema.net/2",
      "type": "object",
      "properties": {
        "_id": {
          "id": "http://jsonschema.net/2/_id",
          "type": "string"
        },
        "index": {
          "id": "http://jsonschema.net/2/index",
          "type": "integer"
        },
        "guid": {
          "id": "http://jsonschema.net/2/guid",
          "type": "string"
        },
        "isActive": {
          "id": "http://jsonschema.net/2/isActive",
          "type": "boolean"
        },
        "balance": {
          "id": "http://jsonschema.net/2/balance",
          "type": "string"
        },
        "picture": {
          "id": "http://jsonschema.net/2/picture",
          "type": "string"
        },
        "age": {
          "id": "http://jsonschema.net/2/age",
          "type": "integer"
        },
        "eyeColor": {
          "id": "http://jsonschema.net/2/eyeColor",
          "type": "string"
        },
        "name": {
          "id": "http://jsonschema.net/2/name",
          "type": "string"
        },
        "gender": {
          "id": "http://jsonschema.net/2/gender",
          "type": "string"
        },
        "company": {
          "id": "http://jsonschema.net/2/company",
          "type": "string"
        },
        "email": {
          "id": "http://jsonschema.net/2/email",
          "type": "string"
        },
        "phone": {
          "id": "http://jsonschema.net/2/phone",
          "type": "string"
        },
        "address": {
          "id": "http://jsonschema.net/2/address",
          "type": "string"
        },
        "about": {
          "id": "http://jsonschema.net/2/about",
          "type": "string"
        },
        "registered": {
          "id": "http://jsonschema.net/2/registered",
          "type": "string"
        },
        "latitude": {
          "id": "http://jsonschema.net/2/latitude",
          "type": "number"
        },
        "longitude": {
          "id": "http://jsonschema.net/2/longitude",
          "type": "number"
        },
        "tags": {
          "id": "http://jsonschema.net/2/tags",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/2/tags/0",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/2/tags/1",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/2/tags/2",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/2/tags/3",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/2/tags/4",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/2/tags/5",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/2/tags/6",
              "type": "string"
            }
          ]
        },
        "friends": {
          "id": "http://jsonschema.net/2/friends",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/2/friends/0",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/2/friends/0/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/2/friends/0/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/2/friends/1",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/2/friends/1/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/2/friends/1/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/2/friends/2",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/2/friends/2/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/2/friends/2/name",
                  "type": "string"
                }
              }
            }
          ]
        },
        "greeting": {
          "id": "http://jsonschema.net/2/greeting",
          "type": "string"
        },
        "favoriteFruit": {
          "id": "http://jsonschema.net/2/favoriteFruit",
          "type": "string"
        }
      }
    },
    {
      "id": "http://jsonschema.net/3",
      "type": "object",
      "properties": {
        "_id": {
          "id": "http://jsonschema.net/3/_id",
          "type": "string"
        },
        "index": {
          "id": "http://jsonschema.net/3/index",
          "type": "integer"
        },
        "guid": {
          "id": "http://jsonschema.net/3/guid",
          "type": "string"
        },
        "isActive": {
          "id": "http://jsonschema.net/3/isActive",
          "type": "boolean"
        },
        "balance": {
          "id": "http://jsonschema.net/3/balance",
          "type": "string"
        },
        "picture": {
          "id": "http://jsonschema.net/3/picture",
          "type": "string"
        },
        "age": {
          "id": "http://jsonschema.net/3/age",
          "type": "integer"
        },
        "eyeColor": {
          "id": "http://jsonschema.net/3/eyeColor",
          "type": "string"
        },
        "name": {
          "id": "http://jsonschema.net/3/name",
          "type": "string"
        },
        "gender": {
          "id": "http://jsonschema.net/3/gender",
          "type": "string"
        },
        "company": {
          "id": "http://jsonschema.net/3/company",
          "type": "string"
        },
        "email": {
          "id": "http://jsonschema.net/3/email",
          "type": "string"
        },
        "phone": {
          "id": "http://jsonschema.net/3/phone",
          "type": "string"
        },
        "address": {
          "id": "http://jsonschema.net/3/address",
          "type": "string"
        },
        "about": {
          "id": "http://jsonschema.net/3/about",
          "type": "string"
        },
        "registered": {
          "id": "http://jsonschema.net/3/registered",
          "type": "string"
        },
        "latitude": {
          "id": "http://jsonschema.net/3/latitude",
          "type": "number"
        },
        "longitude": {
          "id": "http://jsonschema.net/3/longitude",
          "type": "number"
        },
        "tags": {
          "id": "http://jsonschema.net/3/tags",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/3/tags/0",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/3/tags/1",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/3/tags/2",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/3/tags/3",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/3/tags/4",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/3/tags/5",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/3/tags/6",
              "type": "string"
            }
          ]
        },
        "friends": {
          "id": "http://jsonschema.net/3/friends",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/3/friends/0",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/3/friends/0/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/3/friends/0/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/3/friends/1",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/3/friends/1/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/3/friends/1/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/3/friends/2",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/3/friends/2/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/3/friends/2/name",
                  "type": "string"
                }
              }
            }
          ]
        },
        "greeting": {
          "id": "http://jsonschema.net/3/greeting",
          "type": "string"
        },
        "favoriteFruit": {
          "id": "http://jsonschema.net/3/favoriteFruit",
          "type": "string"
        }
      }
    },
    {
      "id": "http://jsonschema.net/4",
      "type": "object",
      "properties": {
        "_id": {
          "id": "http://jsonschema.net/4/_id",
          "type": "string"
        },
        "index": {
          "id": "http://jsonschema.net/4/index",
          "type": "integer"
        },
        "guid": {
          "id": "http://jsonschema.net/4/guid",
          "type": "string"
        },
        "isActive": {
          "id": "http://jsonschema.net/4/isActive",
          "type": "boolean"
        },
        "balance": {
          "id": "http://jsonschema.net/4/balance",
          "type": "string"
        },
        "picture": {
          "id": "http://jsonschema.net/4/picture",
          "type": "string"
        },
        "age": {
          "id": "http://jsonschema.net/4/age",
          "type": "integer"
        },
        "eyeColor": {
          "id": "http://jsonschema.net/4/eyeColor",
          "type": "string"
        },
        "name": {
          "id": "http://jsonschema.net/4/name",
          "type": "string"
        },
        "gender": {
          "id": "http://jsonschema.net/4/gender",
          "type": "string"
        },
        "company": {
          "id": "http://jsonschema.net/4/company",
          "type": "string"
        },
        "email": {
          "id": "http://jsonschema.net/4/email",
          "type": "string"
        },
        "phone": {
          "id": "http://jsonschema.net/4/phone",
          "type": "string"
        },
        "address": {
          "id": "http://jsonschema.net/4/address",
          "type": "string"
        },
        "about": {
          "id": "http://jsonschema.net/4/about",
          "type": "string"
        },
        "registered": {
          "id": "http://jsonschema.net/4/registered",
          "type": "string"
        },
        "latitude": {
          "id": "http://jsonschema.net/4/latitude",
          "type": "number"
        },
        "longitude": {
          "id": "http://jsonschema.net/4/longitude",
          "type": "number"
        },
        "tags": {
          "id": "http://jsonschema.net/4/tags",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/4/tags/0",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/4/tags/1",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/4/tags/2",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/4/tags/3",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/4/tags/4",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/4/tags/5",
              "type": "string"
            },
            {
              "id": "http://jsonschema.net/4/tags/6",
              "type": "string"
            }
          ]
        },
        "friends": {
          "id": "http://jsonschema.net/4/friends",
          "type": "array",
          "items": [
            {
              "id": "http://jsonschema.net/4/friends/0",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/4/friends/0/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/4/friends/0/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/4/friends/1",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/4/friends/1/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/4/friends/1/name",
                  "type": "string"
                }
              }
            },
            {
              "id": "http://jsonschema.net/4/friends/2",
              "type": "object",
              "properties": {
                "id": {
                  "id": "http://jsonschema.net/4/friends/2/id",
                  "type": "integer"
                },
                "name": {
                  "id": "http://jsonschema.net/4/friends/2/name",
                  "type": "string"
                }
              }
            }
          ]
        },
        "greeting": {
          "id": "http://jsonschema.net/4/greeting",
          "type": "string"
        },
        "favoriteFruit": {
          "id": "http://jsonschema.net/4/favoriteFruit",
          "type": "string"
        }
      }
    }
  ],
  "required": [
    "0",
    "1",
    "2",
    "3",
    "4"
  ]
};
var obj = [
  {
    "_id": "556560b766605c41d66d5910",
    "index": 0,
    "guid": "b0057de2-b2b9-4f5e-8a10-3259e54ac5ae",
    "isActive": true,
    "balance": "$3,798.63",
    "picture": "http://placehold.it/32x32",
    "age": 40,
    "eyeColor": "blue",
    "name": "Shawn Evans",
    "gender": "female",
    "company": "FOSSIEL",
    "email": "shawnevans@fossiel.com",
    "phone": "+1 (956) 479-2930",
    "address": "879 Meserole Avenue, Norvelt, Indiana, 428",
    "about": "Cillum qui dolor quis sunt do aliquip aliqua pariatur ut laborum. Anim sit dolor tempor fugiat mollit nostrud veniam ad velit elit. Ea commodo ad incididunt voluptate.\r\n",
    "registered": "2014-04-20T14:33:16 -04:00",
    "latitude": -40.01082,
    "longitude": -118.957523,
    "tags": [
      "consequat",
      "ex",
      "non",
      "irure",
      "id",
      "sint",
      "eu"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Keisha Duncan"
      },
      {
        "id": 1,
        "name": "Blanca Cantu"
      },
      {
        "id": 2,
        "name": "Deidre Cotton"
      }
    ],
    "greeting": "Hello, Shawn Evans! You have 1 unread messages.",
    "favoriteFruit": "apple"
  },
  {
    "_id": "556560b74f4b9e71e73d7856",
    "index": 1,
    "guid": "92c770b3-80b8-4bdc-aad4-9a2330bb0a23",
    "isActive": true,
    "balance": "$1,315.39",
    "picture": "http://placehold.it/32x32",
    "age": 29,
    "eyeColor": "brown",
    "name": "Lucas Pacheco",
    "gender": "male",
    "company": "MOTOVATE",
    "email": "lucaspacheco@motovate.com",
    "phone": "+1 (988) 541-2454",
    "address": "589 Gunther Place, Carrsville, Washington, 520",
    "about": "Deserunt cillum magna ut irure nostrud dolor sunt excepteur anim enim. Qui dolore fugiat nulla velit velit fugiat proident nostrud nulla exercitation non. Tempor tempor et consequat consequat aute eiusmod commodo veniam ad veniam laborum.\r\n",
    "registered": "2015-04-24T03:13:02 -04:00",
    "latitude": -45.336031,
    "longitude": 150.45798,
    "tags": [
      "id",
      "laboris",
      "ea",
      "officia",
      "laborum",
      "minim",
      "labore"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Jackson Charles"
      },
      {
        "id": 1,
        "name": "Burt Cline"
      },
      {
        "id": 2,
        "name": "Weiss Randall"
      }
    ],
    "greeting": "Hello, Lucas Pacheco! You have 10 unread messages.",
    "favoriteFruit": "strawberry"
  },
  {
    "_id": "556560b7a46b9075e0196ceb",
    "index": 2,
    "guid": "ee7bd878-7759-4805-93ad-dff5358c9127",
    "isActive": true,
    "balance": "$2,162.78",
    "picture": "http://placehold.it/32x32",
    "age": 28,
    "eyeColor": "green",
    "name": "Haynes Mccarthy",
    "gender": "male",
    "company": "DUOFLEX",
    "email": "haynesmccarthy@duoflex.com",
    "phone": "+1 (982) 465-2986",
    "address": "964 Amity Street, Clinton, Montana, 3904",
    "about": "Nostrud excepteur exercitation aliquip deserunt pariatur enim amet aute qui. Aliquip est dolore dolor deserunt irure laborum cillum dolor. Cillum id est aliquip aliquip sunt anim tempor officia est. Amet Lorem consectetur sint nulla incididunt est occaecat. Do aute enim est laboris laboris cillum culpa ea. Nulla velit id labore aliquip voluptate ex.\r\n",
    "registered": "2014-07-31T00:55:13 -04:00",
    "latitude": -75.735289,
    "longitude": 104.668396,
    "tags": [
      "anim",
      "do",
      "ea",
      "reprehenderit",
      "laboris",
      "commodo",
      "ea"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Bates Mayo"
      },
      {
        "id": 1,
        "name": "Koch Cardenas"
      },
      {
        "id": 2,
        "name": "Harrison Bishop"
      }
    ],
    "greeting": "Hello, Haynes Mccarthy! You have 7 unread messages.",
    "favoriteFruit": "apple"
  },
  {
    "_id": "556560b75909befce91e6e1e",
    "index": 3,
    "guid": "c6606f4c-c424-4614-9ccf-eb24012f6469",
    "isActive": true,
    "balance": "$3,982.88",
    "picture": "http://placehold.it/32x32",
    "age": 21,
    "eyeColor": "brown",
    "name": "Stephens Mercer",
    "gender": "male",
    "company": "ZOID",
    "email": "stephensmercer@zoid.com",
    "phone": "+1 (854) 545-3206",
    "address": "332 Autumn Avenue, Makena, New Mexico, 2363",
    "about": "Fugiat reprehenderit consectetur ullamco deserunt. Mollit amet adipisicing sunt voluptate mollit elit non Lorem ut excepteur exercitation minim magna. Esse consectetur adipisicing magna aliqua exercitation anim quis officia et commodo.\r\n",
    "registered": "2014-01-20T15:13:25 -04:00",
    "latitude": -48.455294,
    "longitude": -129.759485,
    "tags": [
      "dolore",
      "id",
      "cupidatat",
      "qui",
      "deserunt",
      "ea",
      "pariatur"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Bridgette Craig"
      },
      {
        "id": 1,
        "name": "Maryellen Saunders"
      },
      {
        "id": 2,
        "name": "Mclaughlin Oneal"
      }
    ],
    "greeting": "Hello, Stephens Mercer! You have 4 unread messages.",
    "favoriteFruit": "apple"
  },
  {
    "_id": "556560b7154ca98f4e1dec03",
    "index": 4,
    "guid": "161c6649-9dc8-4e19-8f61-a99f9ffa0543",
    "isActive": true,
    "balance": "$2,613.57",
    "picture": "http://placehold.it/32x32",
    "age": 30,
    "eyeColor": "green",
    "name": "Rosemarie Levy",
    "gender": "female",
    "company": "NORSUL",
    "email": "rosemarielevy@norsul.com",
    "phone": "+1 (837) 545-2870",
    "address": "803 Cumberland Street, Loveland, Colorado, 8884",
    "about": "Sit anim est non elit aliquip Lorem enim mollit id exercitation culpa quis. Do irure dolor laborum et consequat ullamco. Quis culpa fugiat do occaecat adipisicing ipsum labore mollit. Ad cillum id voluptate consectetur incididunt dolore non laboris. Dolor exercitation ad exercitation et.\r\n",
    "registered": "2014-11-21T22:37:15 -04:00",
    "latitude": 29.446521,
    "longitude": 69.509939,
    "tags": [
      "deserunt",
      "reprehenderit",
      "qui",
      "tempor",
      "est",
      "enim",
      "non"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Cathleen Griffin"
      },
      {
        "id": 1,
        "name": "Beulah Hester"
      },
      {
        "id": 2,
        "name": "Staci Carney"
      }
    ],
    "greeting": "Hello, Rosemarie Levy! You have 10 unread messages.",
    "favoriteFruit": "strawberry"
  }
];
var j = require('is-my-json-valid');
var validate = j(_schema, { copy:false });
var res = validate(obj);
console.log(res);

As you can see in the schema the property "guid" must be a number, but in the object this property is a string. The result of validation is TRUE. That's wrong!

An another example: schema = { type : "number", multipleOf : 0.0001 } object = 1; The result is FALSE, but must be TRUE

chrahunt commented 9 years ago

Your first schema is an array but defined as a you would a "tuple"-like array, see here for information on this. If you want to restrict "tuple"-like array items to only those present in the items array, then you must add "additionalItems": false to your array schema. Adding this key to your schema resulted in the _id and guid fields being identified as the incorrect type. See here for an edited version of your example that works correctly. Additionally, the "required" key has no meaning in an array, as far as I know.

It looks like your goal is to ensure that all items in your array match a certain format, in that case it would be more practical to set the "items" key to a schema object directly, as you can see here.

For your second issue, I ran the following code and received a result of true. Can you provide an example where this is not working?

var j = require('is-my-json-valid');

var schema = {
  type: "number",
  multipleOf: 0.0001
};

var obj = 1;
var validate = j(schema, { verbose: true });
var res = validate(obj);

console.log(res);

if (!res) {
  console.log(validate.errors);
}
pashoo2 commented 9 years ago

Thank you for explaining the problems with the first schema. May be the second problem has been resolved. The first error as an example, it does not for working application

pashoo2 commented 9 years ago

This schema:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "/",
    "type": "array",
    "additionalItems": false,
    "items": [
        {
            "id": "0",
            "type": "object",
            "properties": {
                "_id": {
                    "id": "_id",
                    "type": "string",
                    "minLength": 1
                },
                "index": {
                    "id": "index",
                    "type": "integer"
                },
                "guid": {
                    "id": "guid",
                    "type": "string",
                    "minLength": 1
                },
                "isActive": {
                    "id": "isActive",
                    "type": "boolean"
                },
                "balance": {
                    "id": "balance",
                    "type": "string",
                    "minLength": 1
                },
                "picture": {
                    "id": "picture",
                    "type": "string",
                    "minLength": 1
                },
                "age": {
                    "id": "age",
                    "type": "integer"
                },
                "eyeColor": {
                    "id": "eyeColor",
                    "type": "string",
                    "minLength": 1
                },
                "name": {
                    "id": "name",
                    "type": "string",
                    "minLength": 1
                },
                "gender": {
                    "id": "gender",
                    "type": "string",
                    "minLength": 1
                },
                "company": {
                    "id": "company",
                    "type": "string",
                    "minLength": 1
                },
                "email": {
                    "id": "email",
                    "type": "string",
                    "minLength": 1
                },
                "phone": {
                    "id": "phone",
                    "type": "string",
                    "minLength": 1
                },
                "address": {
                    "id": "address",
                    "type": "string",
                    "minLength": 1
                },
                "about": {
                    "id": "about",
                    "type": "string",
                    "minLength": 1
                },
                "registered": {
                    "id": "registered",
                    "type": "string",
                    "minLength": 1
                },
                "latitude": {
                    "id": "latitude",
                    "type": "number"
                },
                "longitude": {
                    "id": "longitude",
                    "type": "number"
                },
                "tags": {
                    "id": "tags",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "1",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "2",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "3",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "4",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "5",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "6",
                            "type": "string",
                            "minLength": 1
                        }
                    ],
                    "additionalItems": false
                },
                "friends": {
                    "id": "friends",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "1",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "2",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "3",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "4",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        }
                    ],
                    "additionalItems": false
                },
                "greeting": {
                    "id": "greeting",
                    "type": "string",
                    "minLength": 1
                },
                "favoriteFruit": {
                    "id": "favoriteFruit",
                    "type": "string",
                    "minLength": 1
                }
            },
            "additionalProperties": false,
            "required": [
                "_id",
                "index",
                "guid",
                "isActive",
                "balance",
                "picture",
                "age",
                "eyeColor",
                "name",
                "gender",
                "company",
                "email",
                "phone",
                "address",
                "about",
                "registered",
                "latitude",
                "longitude",
                "tags",
                "friends",
                "greeting",
                "favoriteFruit"
            ]
        },
        {
            "id": "1",
            "type": "object",
            "properties": {
                "_id": {
                    "id": "_id",
                    "type": "string",
                    "minLength": 1
                },
                "index": {
                    "id": "index",
                    "type": "integer"
                },
                "guid": {
                    "id": "guid",
                    "type": "string",
                    "minLength": 1
                },
                "isActive": {
                    "id": "isActive",
                    "type": "boolean"
                },
                "balance": {
                    "id": "balance",
                    "type": "string",
                    "minLength": 1
                },
                "picture": {
                    "id": "picture",
                    "type": "string",
                    "minLength": 1
                },
                "age": {
                    "id": "age",
                    "type": "integer"
                },
                "eyeColor": {
                    "id": "eyeColor",
                    "type": "string",
                    "minLength": 1
                },
                "name": {
                    "id": "name",
                    "type": "string",
                    "minLength": 1
                },
                "gender": {
                    "id": "gender",
                    "type": "string",
                    "minLength": 1
                },
                "company": {
                    "id": "company",
                    "type": "string",
                    "minLength": 1
                },
                "email": {
                    "id": "email",
                    "type": "string",
                    "minLength": 1
                },
                "phone": {
                    "id": "phone",
                    "type": "string",
                    "minLength": 1
                },
                "address": {
                    "id": "address",
                    "type": "string",
                    "minLength": 1
                },
                "about": {
                    "id": "about",
                    "type": "string",
                    "minLength": 1
                },
                "registered": {
                    "id": "registered",
                    "type": "string",
                    "minLength": 1
                },
                "latitude": {
                    "id": "latitude",
                    "type": "number"
                },
                "longitude": {
                    "id": "longitude",
                    "type": "number"
                },
                "tags": {
                    "id": "tags",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "1",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "2",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "3",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "4",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "5",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "6",
                            "type": "string",
                            "minLength": 1
                        }
                    ],
                    "additionalItems": false
                },
                "friends": {
                    "id": "friends",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "1",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "2",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "3",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "4",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        }
                    ],
                    "additionalItems": false
                },
                "greeting": {
                    "id": "greeting",
                    "type": "string",
                    "minLength": 1
                },
                "favoriteFruit": {
                    "id": "favoriteFruit",
                    "type": "string",
                    "minLength": 1
                }
            },
            "additionalProperties": false
        },
        {
            "id": "2",
            "type": "object",
            "properties": {
                "_id": {
                    "id": "_id",
                    "type": "string",
                    "minLength": 1
                },
                "index": {
                    "id": "index",
                    "type": "integer"
                },
                "guid": {
                    "id": "guid",
                    "type": "string",
                    "minLength": 1
                },
                "isActive": {
                    "id": "isActive",
                    "type": "boolean"
                },
                "balance": {
                    "id": "balance",
                    "type": "string",
                    "minLength": 1
                },
                "picture": {
                    "id": "picture",
                    "type": "string",
                    "minLength": 1
                },
                "age": {
                    "id": "age",
                    "type": "integer"
                },
                "eyeColor": {
                    "id": "eyeColor",
                    "type": "string",
                    "minLength": 1
                },
                "name": {
                    "id": "name",
                    "type": "string",
                    "minLength": 1
                },
                "gender": {
                    "id": "gender",
                    "type": "string",
                    "minLength": 1
                },
                "company": {
                    "id": "company",
                    "type": "string",
                    "minLength": 1
                },
                "email": {
                    "id": "email",
                    "type": "string",
                    "minLength": 1
                },
                "phone": {
                    "id": "phone",
                    "type": "string",
                    "minLength": 1
                },
                "address": {
                    "id": "address",
                    "type": "string",
                    "minLength": 1
                },
                "about": {
                    "id": "about",
                    "type": "string",
                    "minLength": 1
                },
                "registered": {
                    "id": "registered",
                    "type": "string",
                    "minLength": 1
                },
                "latitude": {
                    "id": "latitude",
                    "type": "number"
                },
                "longitude": {
                    "id": "longitude",
                    "type": "number"
                },
                "tags": {
                    "id": "tags",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "1",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "2",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "3",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "4",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "5",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "6",
                            "type": "string",
                            "minLength": 1
                        }
                    ],
                    "additionalItems": false
                },
                "friends": {
                    "id": "friends",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "1",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "2",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "3",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "4",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        }
                    ],
                    "additionalItems": false
                },
                "greeting": {
                    "id": "greeting",
                    "type": "string",
                    "minLength": 1
                },
                "favoriteFruit": {
                    "id": "favoriteFruit",
                    "type": "string",
                    "minLength": 1
                }
            },
            "additionalProperties": false
        },
        {
            "id": "3",
            "type": "object",
            "properties": {
                "_id": {
                    "id": "_id",
                    "type": "string",
                    "minLength": 1
                },
                "index": {
                    "id": "index",
                    "type": "integer"
                },
                "guid": {
                    "id": "guid",
                    "type": "string",
                    "minLength": 1
                },
                "isActive": {
                    "id": "isActive",
                    "type": "boolean"
                },
                "balance": {
                    "id": "balance",
                    "type": "string",
                    "minLength": 1
                },
                "picture": {
                    "id": "picture",
                    "type": "string",
                    "minLength": 1
                },
                "age": {
                    "id": "age",
                    "type": "integer"
                },
                "eyeColor": {
                    "id": "eyeColor",
                    "type": "string",
                    "minLength": 1
                },
                "name": {
                    "id": "name",
                    "type": "string",
                    "minLength": 1
                },
                "gender": {
                    "id": "gender",
                    "type": "string",
                    "minLength": 1
                },
                "company": {
                    "id": "company",
                    "type": "string",
                    "minLength": 1
                },
                "email": {
                    "id": "email",
                    "type": "string",
                    "minLength": 1
                },
                "phone": {
                    "id": "phone",
                    "type": "string",
                    "minLength": 1
                },
                "address": {
                    "id": "address",
                    "type": "string",
                    "minLength": 1
                },
                "about": {
                    "id": "about",
                    "type": "string",
                    "minLength": 1
                },
                "registered": {
                    "id": "registered",
                    "type": "string",
                    "minLength": 1
                },
                "latitude": {
                    "id": "latitude",
                    "type": "number"
                },
                "longitude": {
                    "id": "longitude",
                    "type": "number"
                },
                "tags": {
                    "id": "tags",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "1",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "2",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "3",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "4",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "5",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "6",
                            "type": "string",
                            "minLength": 1
                        }
                    ],
                    "additionalItems": false
                },
                "friends": {
                    "id": "friends",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "1",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "2",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "3",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "4",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        }
                    ],
                    "additionalItems": false
                },
                "greeting": {
                    "id": "greeting",
                    "type": "string",
                    "minLength": 1
                },
                "favoriteFruit": {
                    "id": "favoriteFruit",
                    "type": "string",
                    "minLength": 1
                }
            },
            "additionalProperties": false
        },
        {
            "id": "4",
            "type": "object",
            "properties": {
                "_id": {
                    "id": "_id",
                    "type": "string",
                    "minLength": 1
                },
                "index": {
                    "id": "index",
                    "type": "integer"
                },
                "guid": {
                    "id": "guid",
                    "type": "string",
                    "minLength": 1
                },
                "isActive": {
                    "id": "isActive",
                    "type": "boolean"
                },
                "balance": {
                    "id": "balance",
                    "type": "string",
                    "minLength": 1
                },
                "picture": {
                    "id": "picture",
                    "type": "string",
                    "minLength": 1
                },
                "age": {
                    "id": "age",
                    "type": "integer"
                },
                "eyeColor": {
                    "id": "eyeColor",
                    "type": "string",
                    "minLength": 1
                },
                "name": {
                    "id": "name",
                    "type": "string",
                    "minLength": 1
                },
                "gender": {
                    "id": "gender",
                    "type": "string",
                    "minLength": 1
                },
                "company": {
                    "id": "company",
                    "type": "string",
                    "minLength": 1
                },
                "email": {
                    "id": "email",
                    "type": "string",
                    "minLength": 1
                },
                "phone": {
                    "id": "phone",
                    "type": "string",
                    "minLength": 1
                },
                "address": {
                    "id": "address",
                    "type": "string",
                    "minLength": 1
                },
                "about": {
                    "id": "about",
                    "type": "string",
                    "minLength": 1
                },
                "registered": {
                    "id": "registered",
                    "type": "string",
                    "minLength": 1
                },
                "latitude": {
                    "id": "latitude",
                    "type": "number"
                },
                "longitude": {
                    "id": "longitude",
                    "type": "number"
                },
                "tags": {
                    "id": "tags",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "1",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "2",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "3",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "4",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "5",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "6",
                            "type": "string",
                            "minLength": 1
                        }
                    ],
                    "additionalItems": false
                },
                "friends": {
                    "id": "friends",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "1",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "2",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "3",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "4",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        }
                    ],
                    "additionalItems": false
                },
                "greeting": {
                    "id": "greeting",
                    "type": "string",
                    "minLength": 1
                },
                "favoriteFruit": {
                    "id": "favoriteFruit",
                    "type": "string",
                    "minLength": 1
                }
            },
            "additionalProperties": false
        },
        {
            "id": "5",
            "type": "object",
            "properties": {
                "_id": {
                    "id": "_id",
                    "type": "string",
                    "minLength": 1
                },
                "index": {
                    "id": "index",
                    "type": "integer"
                },
                "guid": {
                    "id": "guid",
                    "type": "string",
                    "minLength": 1
                },
                "isActive": {
                    "id": "isActive",
                    "type": "boolean"
                },
                "balance": {
                    "id": "balance",
                    "type": "string",
                    "minLength": 1
                },
                "picture": {
                    "id": "picture",
                    "type": "string",
                    "minLength": 1
                },
                "age": {
                    "id": "age",
                    "type": "integer"
                },
                "eyeColor": {
                    "id": "eyeColor",
                    "type": "string",
                    "minLength": 1
                },
                "name": {
                    "id": "name",
                    "type": "string",
                    "minLength": 1
                },
                "gender": {
                    "id": "gender",
                    "type": "string",
                    "minLength": 1
                },
                "company": {
                    "id": "company",
                    "type": "string",
                    "minLength": 1
                },
                "email": {
                    "id": "email",
                    "type": "string",
                    "minLength": 1
                },
                "phone": {
                    "id": "phone",
                    "type": "string",
                    "minLength": 1
                },
                "address": {
                    "id": "address",
                    "type": "string",
                    "minLength": 1
                },
                "about": {
                    "id": "about",
                    "type": "string",
                    "minLength": 1
                },
                "registered": {
                    "id": "registered",
                    "type": "string",
                    "minLength": 1
                },
                "latitude": {
                    "id": "latitude",
                    "type": "number"
                },
                "longitude": {
                    "id": "longitude",
                    "type": "number"
                },
                "tags": {
                    "id": "tags",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "1",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "2",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "3",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "4",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "5",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "6",
                            "type": "string",
                            "minLength": 1
                        }
                    ],
                    "additionalItems": false
                },
                "friends": {
                    "id": "friends",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "1",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "2",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "3",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "4",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        }
                    ],
                    "additionalItems": false
                },
                "greeting": {
                    "id": "greeting",
                    "type": "string",
                    "minLength": 1
                },
                "favoriteFruit": {
                    "id": "favoriteFruit",
                    "type": "string",
                    "minLength": 1
              registered  }
            },
            "additionalProperties": false
        },
        {
            "id": "6",
            "type": "object",
            "properties": {
                "_id": {
                    "id": "_id",
                    "type": "string",
                    "minLength": 1
                },
                "index": {
                    "id": "index",
                    "type": "integer"
                },
                "guid": {
                    "id": "guid",
                    "type": "string",
                    "minLength": 1
                },
                "isActive": {
                    "id": "isActive",
                    "type": "boolean"
                },
                "balance": {
                    "id": "balance",
                    "type": "string",
                    "minLength": 1
                },
                "picture": {
                    "id": "picture",
                    "type": "string",
                    "minLength": 1
                },
                "age": {
                    "id": "age",
                    "type": "integer"
                },
                "eyeColor": {
                    "id": "eyeColor",
                    "type": "string",
                    "minLength": 1
                },
                "name": {
                    "id": "name",
                    "type": "string",
                    "minLength": 1
                },
                "gender": {
                    "id": "gender",
                    "type": "string",
                    "minLength": 1
                },
                "company": {
                    "id": "company",
                    "type": "string",
                    "minLength": 1
                },
                "email": {
                    "id": "email",
                    "type": "string",
                    "minLength": 1
                },
                "phone": {
                    "id": "phone",
                    "type": "string",
                    "minLength": 1
                },
                "address": {
                    "id": "address",
                    "type": "string",
                    "minLength": 1
                },
                "about": {
                    "id": "about",
                    "type": "string",
                    "minLength": 1
                },
                "registered": {
                    "id": "registered",
                    "type": "string",
                    "minLength": 1
                },
                "latitude": {
                    "id": "latitude",
                    "type": "number"
                },
                "longitude": {
                    "id": "longitude",
                    "type": "number"
                },
                "tags": {
                    "id": "tags",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "1",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "2",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "3",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "4",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "5",
                            "type": "string",
                            "minLength": 1
                        },
                        {
                            "id": "6",
                            "type": "string",
                            "minLength": 1
                        }
                    ],
                    "additionalItems": false
                },
                "friends": {
                    "id": "friends",
                    "type": "array",
                    "items": [
                        {
                            "id": "0",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "1",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "2",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "3",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        },
                        {
                            "id": "4",
                            "type": "object",
                            "properties": {
                                "id": {
                                    "id": "id",
                                    "type": "integer"
                                },
                                "name": {
                                    "id": "name",
                                    "type": "string",
                                    "minLength": 1
                                }
                            },
                            "additionalProperties": false
                        }
                    ],
                    "additionalItems": false
                },
                "greeting": {
                    "id": "greeting",
                    "type": "string",
                    "minLength": 1
                },
                "favoriteFruit": {
                    "id": "favoriteFruit",
                    "type": "string",
                    "minLength": 1
                }
            },
            "additionalProperties": false
        }
    ],
    "required": [
        "0",
        "1",
        "2",
        "3",
        "4",
        "5",
        "6"
    ]
};

FOR THIS OBJECT:

[
  {
    "_id": "5566a9d607f9a131f6d7ad1b",
    "index": 0,
    "guid": "6a700eff-affc-41ea-ae58-de1be45562b5",
    "isActive": true,
    "balance": "$3,654.50",
    "picture": "http://placehold.it/32x32",
    "age": 32,
    "eyeColor": "green",
    "name": "Stevens Dixon",
    "gender": "male",
    "company": "COMSTRUCT",
    "email": "stevensdixon@comstruct.com",
    "phone": "+1 (830) 458-2040",
    "address": "467 Bowne Street, Dexter, Nebraska, 9349",
    "about": "Qui consectetur duis reprehenderit labore ea ipsum sunt id. Culpa minim ut ex sunt commodo laboris nostrud aute adipisicing dolor labore commodo esse. Adipisicing ut nisi eu et culpa enim eiusmod consequat sint. Nisi consectetur deserunt proident pariatur aute. Officia culpa amet veniam nulla cillum sunt. Sunt minim voluptate eiusmod qui consequat in in amet.\r\n",
    "registered": "2014-08-16T07:23:57 -04:00",
    "latitude": -55.373443,
    "longitude": 3.252116,
    "tags": [
      "ullamco",
      "aliqua",
      "sint",
      "eu",
      "in",
      "in",
      "exercitation"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Marks Chandler"
      },
      {
        "id": 1,
        "name": "Walton Marks"
      },
      {
        "id": 2,
        "name": "Marie Rasmussen"
      },
      {
        "id": 3,
        "name": "Long David"
      },
      {
        "id": 4,
        "name": "Kathie Hansen"
      }
    ],
    "greeting": "Hello, Stevens Dixon! You have 10 unread messages.",
    "favoriteFruit": "apple"
  },
  {
    "_id": "5566a9d6000693abc41c6c33",
    "index": 1,
    "guid": "2d57a01f-2080-4291-b40e-d4dd7ddb84d5",
    "isActive": true,
    "balance": "$1,880.01",
    "picture": "http://placehold.it/32x32",
    "age": 20,
    "eyeColor": "brown",
    "name": "Lorrie Spence",
    "gender": "female",
    "company": "EXTRAWEAR",
    "email": "lorriespence@extrawear.com",
    "phone": "+1 (893) 516-2065",
    "address": "197 Ash Street, Eastvale, Montana, 9099",
    "about": "Lorem non in est sit deserunt adipisicing commodo et consequat cupidatat voluptate exercitation labore adipisicing. Officia tempor commodo incididunt excepteur consequat et aliqua aute veniam. Dolor voluptate cillum dolore cillum nisi officia ad in nostrud qui ex. Officia veniam esse sint nisi fugiat qui tempor aliquip sunt fugiat.\r\n",
    "registered": "2014-12-29T04:28:07 -04:00",
    "latitude": -30.852935,
    "longitude": 15.010266,
    "tags": [
      "non",
      "deserunt",
      "consectetur",
      "proident",
      "incididunt",
      "magna",
      "ut"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Ballard Joyner"
      },
      {
        "id": 1,
        "name": "Chrystal Goodwin"
      },
      {
        "id": 2,
        "name": "Hahn Flynn"
      },
      {
        "id": 3,
        "name": "Obrien Meyers"
      },
      {
        "id": 4,
        "name": "Daniels Chapman"
      }
    ],
    "greeting": "Hello, Lorrie Spence! You have 10 unread messages.",
    "favoriteFruit": "banana"
  },
  {
    "_id": "5566a9d6b7296e3fbb5e850e",
    "index": 2,
    "guid": "f8bd6321-3f00-4099-a7de-a19415ecf387",
    "isActive": false,
    "balance": "$2,135.77",
    "picture": "http://placehold.it/32x32",
    "age": 40,
    "eyeColor": "brown",
    "name": "Short Dominguez",
    "gender": "male",
    "company": "NETAGY",
    "email": "shortdominguez@netagy.com",
    "phone": "+1 (957) 462-3874",
    "address": "419 Diamond Street, Harrison, South Carolina, 366",
    "about": "Pariatur sit culpa laborum cillum duis velit sunt cupidatat aliqua. Eiusmod culpa sint mollit excepteur cupidatat officia. Sunt est pariatur minim tempor ipsum exercitation adipisicing nisi proident cillum adipisicing. Do in elit culpa sint sint enim. Commodo dolor sint nostrud elit velit consectetur deserunt aliquip exercitation ullamco aliquip dolore duis. Eu nulla tempor aute sit eiusmod est duis nisi ullamco adipisicing. Culpa reprehenderit tempor proident dolore ex est.\r\n",
    "registered": "2014-04-26T00:17:22 -04:00",
    "latitude": -79.015436,
    "longitude": -89.814684,
    "tags": [
      "laboris",
      "ut",
      "irure",
      "culpa",
      "aute",
      "mollit",
      "nulla"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Carlson Ortega"
      },
      {
        "id": 1,
        "name": "Brandie Reese"
      },
      {
        "id": 2,
        "name": "Gabriela Edwards"
      },
      {
        "id": 3,
        "name": "Carmella Holcomb"
      },
      {
        "id": 4,
        "name": "Tyson Crawford"
      }
    ],
    "greeting": "Hello, Short Dominguez! You have 9 unread messages.",
    "favoriteFruit": "banana"
  },
  {
    "_id": "5566a9d6c746d50a3cd00731",
    "index": 3,
    "guid": "2d51346d-c897-41c8-88b2-1106c1c8f9b8",
    "isActive": false,
    "balance": "$2,575.34",
    "picture": "http://placehold.it/32x32",
    "age": 34,
    "eyeColor": "brown",
    "name": "Sheppard Stuart",
    "gender": "male",
    "company": "INVENTURE",
    "email": "sheppardstuart@inventure.com",
    "phone": "+1 (832) 452-3682",
    "address": "741 Wallabout Street, Vaughn, Connecticut, 9206",
    "about": "Ea cupidatat qui aliquip pariatur eiusmod eiusmod consequat. Sunt fugiat elit consectetur elit. Culpa nostrud ad magna non non ad voluptate pariatur cillum sunt. Duis minim voluptate anim sunt non culpa incididunt tempor deserunt nostrud consequat. Proident culpa cupidatat Lorem laboris est culpa dolor do. In fugiat consectetur sunt commodo nostrud ipsum minim consequat ullamco nulla. Et eu sunt dolore nulla laborum elit consectetur est.\r\n",
    "registered": "2015-05-18T22:44:03 -04:00",
    "latitude": -51.096724,
    "longitude": -175.467606,
    "tags": [
      "adipisicing",
      "esse",
      "non",
      "voluptate",
      "est",
      "ad",
      "ut"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Estelle King"
      },
      {
        "id": 1,
        "name": "Crane Savage"
      },
      {
        "id": 2,
        "name": "Vanessa Salazar"
      },
      {
        "id": 3,
        "name": "Sue Mcneil"
      },
      {
        "id": 4,
        "name": "Duke Park"
      }
    ],
    "greeting": "Hello, Sheppard Stuart! You have 5 unread messages.",
    "favoriteFruit": "strawberry"
  },
  {
    "_id": "5566a9d6c5d56bb6c95407c5",
    "index": 4,
    "guid": "9593b9c2-25dc-41b9-a7b9-634cf4b134f2",
    "isActive": true,
    "balance": "$2,058.26",
    "picture": "http://placehold.it/32x32",
    "age": 27,
    "eyeColor": "blue",
    "name": "Mullen Bishop",
    "gender": "male",
    "company": "SYBIXTEX",
    "email": "mullenbishop@sybixtex.com",
    "phone": "+1 (918) 472-2374",
    "address": "994 Railroad Avenue, Orin, Hawaii, 5857",
    "about": "Sint esse elit cupidatat esse quis nulla officia quis. Duis voluptate sit ea consequat officia fugiat dolore dolor sunt aute elit eiusmod culpa. Voluptate deserunt amet anim tempor Lorem laborum est magna ex eiusmod voluptate. Do consequat consectetur mollit occaecat dolor.\r\n",
    "registered": "2015-04-09T08:51:01 -04:00",
    "latitude": 7.289673,
    "longitude": -33.637138,
    "tags": [
      "elit",
      "irure",
      "consectetur",
      "voluptate",
      "consequat",
      "nisi",
      "ullamco"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Leonard Howell"
      },
      {
        "id": 1,
        "name": "Holder Kemp"
      },
      {
        "id": 2,
        "name": "Vaughan Harrison"
      },
      {
        "id": 3,
        "name": "Dorothy Lara"
      },
      {
        "id": 4,
        "name": "Villarreal Padilla"
      }
    ],
    "greeting": "Hello, Mullen Bishop! You have 9 unread messages.",
    "favoriteFruit": "banana"
  },
  {
    "_id": "5566a9d6d63efc6d39a20a08",
    "index": 5,
    "guid": "2e649c29-9c3b-4149-a4bc-db2072bc538f",
    "isActive": false,
    "balance": "$3,981.37",
    "picture": "http://placehold.it/32x32",
    "age": 35,
    "eyeColor": "brown",
    "name": "Alvarez Kinney",
    "gender": "male",
    "company": "IMPERIUM",
    "email": "alvarezkinney@imperium.com",
    "phone": "+1 (962) 554-3446",
    "address": "485 Bedell Lane, Grapeview, Federated States Of Micronesia, 7284",
    "about": "Cillum occaecat sint irure officia. Adipisicing proident ex pariatur officia duis irure irure laborum quis id sit. Eu aliquip aliquip aliqua voluptate laboris ea tempor consectetur. Reprehenderit tempor est consectetur officia nulla proident do ea.\r\n",
    "registered": "2014-06-17T00:02:32 -04:00",
    "latitude": -38.757573,
    "longitude": 55.134106,
    "tags": [
      "commodo",
      "consectetur",
      "exercitation",
      "elit",
      "occaecat",
      "ut",
      "cillum"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Manuela Wynn"
      },
      {
        "id": 1,
        "name": "Jeanette Bridges"
      },
      {
        "id": 2,
        "name": "Meghan Rosa"
      },
      {
        "id": 3,
        "name": "Calderon Arnold"
      },
      {
        "id": 4,
        "name": "Lakeisha Shields"
      }
    ],
    "greeting": "Hello, Alvarez Kinney! You have 9 unread messages.",
    "favoriteFruit": "apple"
  },
  {
    "_id": "5566a9d6d9a2a5431ad704c9",
    "index": 6,
    "guid": "66242077-9976-4ca9-87b3-b582de8fcac2",
    "isActive": false,
    "balance": "$3,485.69",
    "picture": "http://placehold.it/32x32",
    "age": 37,
    "eyeColor": "blue",
    "name": "Rosalinda Conway",
    "gender": "female",
    "company": "AQUASSEUR",
    "email": "rosalindaconway@aquasseur.com",
    "phone": "+1 (937) 564-3403",
    "address": "104 Hastings Street, Newkirk, Virginia, 862",
    "about": "Ipsum sunt eu sit eiusmod. Voluptate commodo esse non aliqua ex anim proident pariatur elit mollit aliquip. Occaecat ipsum voluptate elit do ullamco commodo culpa ipsum ut fugiat. Sunt sit magna eiusmod cupidatat enim Lorem elit velit adipisicing anim. Aliqua eu consequat duis duis exercitation eiusmod do ut exercitation cupidatat nisi. Consequat veniam nisi quis et velit et.\r\n",
    "registered": "2014-01-19T04:37:53 -04:00",
    "registered_1": "2014-01-19T04:37:53 -04:00",
    "latitude": -84.587131,
    "longitude": 175.762026,
    "tags": [
      "Lorem",
      "ut",
      "eiusmod",
      "est",
      "adipisicing",
      "anim",
      "esse"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Oneal Melendez"
      },
      {
        "id": 1,
        "name": "Hudson Hickman"
      },
      {
        "id": 2,
        "name": "Carolyn Mckenzie"
      },
      {
        "id": 3,
        "name": "Perkins Schroeder"
      },
      {
        "id": 4,
        "name": "Fleming Trevino"
      }
    ],
    "greeting": "Hello, Rosalinda Conway! You have 1 unread messages.",
    "favoriteFruit": "strawberry"
  }
];

The setting "Additional properties" set to false for all objects into the main array. The object have an additional property called "registered_1", but the result of the library execution is "true"