def validate(self, value, attribute_filter=None, minified=False):
if self._required and (value is None or not isinstance(value, dict)):<EOL><INDENT>"""<STR_LIT>"""<EOL>raise exception.RequiredAttributeError()<EOL><DEDENT>if not self._required and not value:<EOL><INDENT>"""<STR_LIT>"""<EOL>return None<EOL><DEDENT>_model_instance = self.__class__()<EOL>rewrite_map = self.attribute_rewrite_map()<EOL>from prestans.parser import AttributeFilter<EOL>from prestans.parser import AttributeFilterImmutable<EOL>for attribute_name, type_instance in self.getmembers():<EOL><INDENT>if not isinstance(type_instance, DataType):<EOL><INDENT>raise TypeError("<STR_LIT>" % attribute_name)<EOL><DEDENT>if isinstance(attribute_filter, (AttributeFilter, AttributeFilterImmutable)) andnot attribute_filter.is_attribute_visible(attribute_name):<EOL><INDENT>_model_instance._attributes[attribute_name] = None<EOL>continue<EOL><DEDENT>validation_input = None<EOL>input_value_key = attribute_name<EOL>if minified is True:<EOL><INDENT>input_value_key = rewrite_map[attribute_name]<EOL><DEDENT>if input_value_key in value:<EOL><INDENT>validation_input = value[input_value_key]<EOL><DEDENT>try:<EOL><INDENT>if isinstance(type_instance, DataCollection):<EOL><INDENT>sub_attribute_filter = None<EOL>if attribute_filter and attribute_name in attribute_filter:<EOL><INDENT>sub_attribute_filter = getattr(attribute_filter, attribute_name)<EOL><DEDENT>validated_object = type_instance.validate(<EOL>validation_input,<EOL>sub_attribute_filter,<EOL>minified<EOL>)<EOL><DEDENT>else:<EOL><INDENT>validated_object = type_instance.validate(validation_input)<EOL><DEDENT>_model_instance._attributes[attribute_name] = validated_object<EOL><DEDENT>except exception.DataValidationException as exp:<EOL><INDENT>raise exception.ValidationError(<EOL>message=str(exp),<EOL>attribute_name=attribute_name,<EOL>value=validation_input,<EOL>blueprint=type_instance.blueprint()<EOL>)<EOL><DEDENT><DEDENT>return _model_instance<EOL>
:param value: serializable input to validate
:type value: dict | None
:param attribute_filter:
:type: prestans.parser.AttributeFilter | None
:param minified: whether or not the input is minified
:type minified: bool
:return: the validated model
:rtype: Model