import { Model } from "../Model" ; import { FuseDB } from "../FuseDB" ; import { storeProp } from "../Utils" ; import { Schema } from "../Schema" ; export function Validate ( data ) { return function ValidateDecorator ( target , propertyKey ) { const schema = storeProp ( target , "$schema" , ( ) => new Schema ( target ) ) ; for ( let key in data ) { const props = data [ key ] ; if ( Schema . validators . has ( key ) ) { schema . addValidator ( propertyKey , props , Schema . validators . get ( key ) ) ; } } } ; }