class Nadap()
Handler to load schema definitions, create/switch namespaces and validate/pre-process data.
property findings
Get a list of ValidationFinding or ReferenceFinding objects containing all validation or reference issues found so far.
Set not implemented.
property schema
Get the current loaded Schema object. (None, if no schema definition has been loaded, yet.)
Set to a dictionary containing a schema definition or to a Schema object.
Raises SchemaDefinitionError if a Syntax error occurs during schema definition parsing.
method load_schema_definition(definition: dict)
Initialize a schema object from the given definition, store the object in the schema property and returns the schema object.
Raises SchemaDefinitionError if given schema definition contains syntax errors.
definition
Dictionary containing a valid schema defintion.
method switch_namespace(namespace: str)
Switch to given namespace string. Creates the namespace, if it is new.
method validate(data: any, flags: nadap.PreProcessingFlag = nadap.NOFLAG)
Validate given data with the current loaded schema and within the current namespace. Returns the validated (and pre-processed) data.
Raises DataValidationError if given data does not match the current data schema.
data
Any data which should be validated.
flags
Pre-processing will respect the given nadap.PreProcessingFlag. Different nadap.PreProcessingFlag objects can be combined to apply multiple instructions.
For example:
n.validate({"key", "value"}, flags=nadap.SET_DEFAULTS | nadap.CONVERT_DATA)