add(app) {
    forEachSpec(app, 'validations', (modelName, model, spec) => {
      // Setup any "oneOf" (property enum/domain) validations
      if (spec.oneOf) {
        let oneOfValidations = spec.oneOf;
        Object.keys(oneOfValidations).forEach(propName => {
          let { values, legend, allowNull } = oneOfValidations[propName];
          allowNull = allowNull === true ? true : false; // allowNull defaults to false

          // Give LoopBack the validation info for the model and property
          model.validatesInclusionOf(propName, {
            in: values,
            message: `${allowNull ? 'may be omitted or explicitly set to null, but otherwise ' : ''}must be one of: ${values.toString()} (i.e., ${legend})`,
            allowNull
          });

          // console.log(`Custom validation: ${modelName}.${propName} ${allowNull ? 'may be omitted or explicitly set to null, but otherwise ' : ''}must be one of ${JSON.stringify(values)} (${legend})`);
        });
      }
    });
  }
/**
   * Add all VuePoint.js custom model property validations
   * @param app The LoopBack app to which we're adding the validations
   */
Add all VuePoint.js custom model property validations
@param app The LoopBack app to which we're adding the validations
Add all VuePoint . js custom model property validations @param app The LoopBack app to which we ' re adding the validations
add(app) {
    forEachSpec(app, 'validations', (modelName, model, spec) => {
      if (spec.oneOf) {
        let oneOfValidations = spec.oneOf;
        Object.keys(oneOfValidations).forEach(propName => {
          let { values, legend, allowNull } = oneOfValidations[propName];
          allowNull = allowNull === true ? true : false; 
          model.validatesInclusionOf(propName, {
            in: values,
            message: `${allowNull ? 'may be omitted or explicitly set to null, but otherwise ' : ''}must be one of: ${values.toString()} (i.e., ${legend})`,
            allowNull
          });
        });
      }
    });
  }
add ( app ) { forEachSpec ( app , 'validations' , ( modelName , model , spec ) => { if ( spec . oneOf ) { let oneOfValidations = spec . oneOf ; Object . keys ( oneOfValidations ) . forEach ( propName => { let { values , legend , allowNull } = oneOfValidations [ propName ] ; allowNull = allowNull === true ? true : false ; model . validatesInclusionOf ( propName , { in : values , message : ` ${ allowNull ? 'may be omitted or explicitly set to null, but otherwise ' : '' } ${ values . toString ( ) } ${ legend } ` , allowNull } ) ; } ) ; } } ) ; }
Add all VuePoint.js custom model property validations
 @param app The LoopBack app to which we're adding the validations
Add all VuePoint . js custom model property validations @param app The LoopBack app to which we ' re adding the validations
// Setup any "oneOf" (property enum/domain) validations // allowNull defaults to false // Give LoopBack the validation info for the model and property // console.log(`Custom validation: ${modelName}.${propName} ${allowNull ? 'may be omitted or explicitly set to null, but otherwise ' : ''}must be one of ${JSON.stringify(values)} (${legend})`);