ValidationRules
struct ValidationRules
ValidationRules specify the behavior of the Validator if it encounters differences between the input Hash and the Schema defining it. The following rules may be set
-
injectDefaults: inject default values if a value for an element defined in the Schema is missing from the input Hash.
-
allowUnrootedConfiguration: allow for unrooted input Hash, i.e. one that doesn't have a classId as the key of the root node
-
allowAdditionalKeys: allow additional keys in the input Hash that do not map to elements specified in the schema
-
allowMissingKeys: allow for keys missing in the input Hash even if an element for this key is present in the schema
-
injectTimestamps for leaf elements:
- if injectTimestamps is false: no injection
- if injectTimestamps is true and forceInjectedTimestamp is false: timestamp is injected, but timestamp attributes present are not overwritten
- if injectTimestamps and forceInjectedTimestamp are both true: timestamp is injected and may overwrite previous timestamp attributes
If any of the above scenarios are encountered during validation and the option is not set to true, i.e. the Validator is not allowed to resolve the issue, validation will fail.
Functions
| Name | Description |
|---|---|
| ValidationRules | The default constructor of validation rules is least restrictive, i.e. all resolution options are set to true. |
Function Details
ValidationRules
ValidationRules()
The default constructor of validation rules is least restrictive, i.e. all resolution options are set to true.