Pip-Services-Commons-Dotnet
Public Member Functions | Private Attributes | List of all members
PipServices3.Commons.Validate.ExcludedRule Class Reference

Validation rule to check that value is excluded from the list of constants. More...

Inheritance diagram for PipServices3.Commons.Validate.ExcludedRule:
PipServices3.Commons.Validate.IValidationRule

Public Member Functions

 ExcludedRule (params object[] values)
 Creates a new validation rule and sets its values. More...
 
void Validate (string path, Schema schema, object value, List< ValidationResult > results)
 Validates the given value. None of the values set in this ExcludedRule object must exist in the value that is given for validation to pass. More...
 

Private Attributes

readonly object [] _values
 

Detailed Description

Validation rule to check that value is excluded from the list of constants.

var schema = new Schema().WithRule(new ExcludedRule(1, 2, 3));
schema.Validate(2); // Result: 2 must not be one of 1, 2, 3
schema.Validate(10); // Result: no errors

Constructor & Destructor Documentation

◆ ExcludedRule()

PipServices3.Commons.Validate.ExcludedRule.ExcludedRule ( params object []  values)

Creates a new validation rule and sets its values.

Parameters
valuesa list of constants that value must be excluded from

Member Function Documentation

◆ Validate()

void PipServices3.Commons.Validate.ExcludedRule.Validate ( string  path,
Schema  schema,
object  value,
List< ValidationResult results 
)

Validates the given value. None of the values set in this ExcludedRule object must exist in the value that is given for validation to pass.

Parameters
patha dot notation path to the value.
schemaa schema this rule is called from
valuea value to be validated.
resultsa list with validation results to add new results.

Implements PipServices3.Commons.Validate.IValidationRule.


The documentation for this class was generated from the following file: