Search code examples
meteorsimple-schema

How to skip validation of object properties for type: [Object]


I'm trying to validate an Array of Objects with Simple-schema..

validate: new SimpleSchema({
    orderId: {type: String},
    skins: {type: [Object]}
}).validator(),

..but it seems that Simple-schema wants me to also validate every single property on every object inside that array, since i'm constantly getting "keyNotInSchema" type validationErrors:

skins.0.appid is not allowed by the schema

Is there any way to cancel validation of each object's property and to instruct Simple-Schema that i want just an "Array of Objects"?


Solution

  • You must declare that this is a blackbox object:

    validate: new SimpleSchema({
        orderId: {type: String},
        skins: {type: [Object], blackbox: true}
    }).validator(),