In addition to the instancevalidate() method, Structure also adds a staticvalidate() to your structure classes that receives a raw object or a structure instance as parameter and has the same return type of the normal validation:
constUser=attributes({ name: { type: String, minLength:10, }, age: { type: Number, required:true, },})(classUser {});// Using a raw objectconstrawData= { name:'John',};const { valid,errors } =User.validate(rawData);valid; // falseerrors; /*[ { message: '"name" length must be at least 10 characters long', path: ['name'] }, { message: '"age" is required', path: ['age'] }]*/// Using a structure instanceconstuser=newUser({ name:'Some long name',});constvalidation=User.validate(user);validation.valid; // falsevalidation.errors; /*[ { message: '"age" is required', path: ['age'] }]*/