pip_services3_commons.validate.IncludedRule module

pip_services3_commons.validate.IncludedRule

Included 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.IncludedRule.IncludedRule(*values: Any)

Bases: pip_services3_commons.validate.IValidationRule.IValidationRule

Validation rule to check that args is included into the list of constants.

Example:

schema = new Schema().with_rule(IncludedRule(1, 2, 3))

schema.validate(2)      # Result: no errors
schema.validate(10)     # Result: 10 must be one of 1, 2, 3
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.