generateValidationDescriptions(schema) {
    const validations = {
      // String
      pattern: value => `Matches regex pattern: \`${value}\``,
      maxLength: value => `Length of string must be less than, or equal to ${value}`,
      minLength: value => `Length of string must be greater than, or equal to ${value}`,

      // Number
      multipleOf: value => `Number must be a multiple of ${value}`,
      maximum: value => `Number must be less than, or equal to ${value}`,
      minimum: value => `Number must be more than, or equal to ${value}`,
      exclusiveMaximum: value => `Number must be less than ${value}`,
      exclusiveMinimum: value => `Number must be more than ${value}`,

      // Object
      minProperties: value => `Object must have more than, or equal to ${value} properties`,
      maxProperties: value => `Object must have less than, or equal to ${value} properties`,

      // Array
      maxItems: value => `Array length must be less than, or equal to ${value}`,
      minItems: value => `Array length must be more than, or equal to ${value}`,
      uniqueItems: () => 'Array contents must be unique',

      // Other
      format: value => `Value must be of format '${value}'`,
    };

    return _
      .chain(validations)
      .map((value, key) => {
        if (schema[key]) {
          return value(schema[key]);
        }

        return null;
      })
      .compact()
      .value();
  }
// Generates an array of descriptions for each validation rule in the given schema.
Generates an array of descriptions for each validation rule in the given schema.
Generates an array of descriptions for each validation rule in the given schema .
generateValidationDescriptions(schema) {
    const validations = {
      pattern: value => `Matches regex pattern: \`${value}\``,
      maxLength: value => `Length of string must be less than, or equal to ${value}`,
      minLength: value => `Length of string must be greater than, or equal to ${value}`,
      multipleOf: value => `Number must be a multiple of ${value}`,
      maximum: value => `Number must be less than, or equal to ${value}`,
      minimum: value => `Number must be more than, or equal to ${value}`,
      exclusiveMaximum: value => `Number must be less than ${value}`,
      exclusiveMinimum: value => `Number must be more than ${value}`,
      minProperties: value => `Object must have more than, or equal to ${value} properties`,
      maxProperties: value => `Object must have less than, or equal to ${value} properties`,
      maxItems: value => `Array length must be less than, or equal to ${value}`,
      minItems: value => `Array length must be more than, or equal to ${value}`,
      uniqueItems: () => 'Array contents must be unique',
      format: value => `Value must be of format '${value}'`,
    };
    return _
      .chain(validations)
      .map((value, key) => {
        if (schema[key]) {
          return value(schema[key]);
        }
        return null;
      })
      .compact()
      .value();
  }
generateValidationDescriptions ( schema ) { const validations = { pattern : value => ` \` ${ value } \` ` , maxLength : value => ` ${ value } ` , minLength : value => ` ${ value } ` , multipleOf : value => ` ${ value } ` , maximum : value => ` ${ value } ` , minimum : value => ` ${ value } ` , exclusiveMaximum : value => ` ${ value } ` , exclusiveMinimum : value => ` ${ value } ` , minProperties : value => ` ${ value } ` , maxProperties : value => ` ${ value } ` , maxItems : value => ` ${ value } ` , minItems : value => ` ${ value } ` , uniqueItems : ( ) => 'Array contents must be unique' , format : value => ` ${ value } ` , } ; return _ . chain ( validations ) . map ( ( value , key ) => { if ( schema [ key ] ) { return value ( schema [ key ] ) ; } return null ; } ) . compact ( ) . value ( ) ; }
Generates an array of descriptions for each validation rule in the given schema.
Generates an array of descriptions for each validation rule in the given schema .
// String // Number // Object // Array // Other