Create a Registry object that defines and stores rules for validating
data against a Schema.
Details
The Registry class serves as a central repository for all the rules used
in fluffy schema and data validation. It is passed to the Schema and
Validator classes, which use the rules stored in the Registry to
validate schemas and data, respectively.
To see the available builtin rules,
use the helper function show_builtins(), which lists all the builtin
rules in a Registry.
As Registry objects are automatically created in the Schema constructor,
which is in turn called in the Validator constructor, a Registry does not
need to be created separately to use fluffy's validation functionality.
Custom rules can also be added to the Registry within a Schema or
Validator object. However, rule addition will trigger re-validation of
the given object, so for the addition of many new rules, it is beneficial
to create a Registry object, add all the rules to it, and then pass it to
the other classes.
For full details see the vignettes on builtin rules, data validation, and adding custom rules.
Additional properties
@rule_names(Read-only) All rules, in order of evaluation. Derived from the combination of the
control,transform,validate, andfinalizerules.@control_rulesRules that influence the control flow. These will be applied in the first pass when validating data.
@transform_rulesRules that transform data. These will be applied in the second pass when validating data.
@validate_rulesRules that validate data. These will be applied in the penultimate pass when validating.
@finalize_rulesRules that finalize validation. These will be applied in the last pass when validating, after all other rules have been applied. These rules will only apply if no previous rules for that schema node have failed.
@str_to_fn_rulesSchema rules that are allowed to have string or function values, with string values being converted to functions automatically during schema validation.
@str_to_fn_converterFunction that converts string values to functions for the
@str_to_fn_rules.@type_names(Read-only) Allowed type names. Derived from the keys of the
@type_map.@type_mapEnvironment mapping type names to type definition functions. Can only be added to via
add_type_rule().@coerce_names(Read-only) Allowed coercion names. Derived from the keys of the
@coerce_map.@coerce_mapEnvironment mapping coercion names to coercion functions. Can only be added to via
add_coerce_rule().@schema_rulesEnvironment mapping schema rule names to schema validation functions. Can only be added to via
add_rule().@cross_rule_names(Read-only) Schema cross rules. Derived from the keys of the
@cross_rulesenvironment.@cross_rulesEnvironment containing the schema cross rule functions (rules that check relationships between multiple schema rule values). Can only be added to via
add_cross_rule().@validator_rulesEnvironment mapping validator rule names to validator functions. Can only be added to via
add_rule().
