pip_services3_commons.validate.AndRule module
pip_services3_commons.validate.AndRule
And rule implementation
- copyright
Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
MIT, see LICENSE for more details.
-
class
pip_services3_commons.validate.AndRule.
AndRule
(*rules: pip_services3_commons.validate.IValidationRule.IValidationRule) Bases:
pip_services3_commons.validate.IValidationRule.IValidationRule
Validation rule to combine __rules with AND logical operation. When all __rules returns no errors, than this rule also returns no errors. When one of the __rules return errors, than the __rules returns all errors.
Example:
schema = Schema().with_rule(AndRule(ValueComparisonRule("GTE", 1), ValueComparisonRule("LTE", 10))) schema.validate(0) # Result: 0 must be greater or equal to 1 schema.validate(5) # Result: no error schema.validate(20) # Result: 20 must be letter or equal 10
-
validate
(path: str, schema: <module 'pip_services3_commons.validate.Schema' from '/pip_services3_commons/validate/Schema.py'>, value: Any, results: List[pip_services3_commons.validate.ValidationResult.ValidationResult]) Validates a given args against this rule.
- Parameters
path – a dot notation path to the args.
schema – a schema this rule is called from
value – a args to be validated.
results – a list with validation results to add new results.
-