cewing commented on a change in pull request #936:
URL: https://github.com/apache/avro/pull/936#discussion_r462527900
##########
File path: lang/py/avro/schema.py
##########
@@ -919,6 +984,10 @@ def to_json(self, names=None):
to_dump['fields'] = [f.to_json(names) for f in self.fields]
return to_dump
+ def validate(self, datum):
+ """Return self if datum is a valid representation of this schema, else
None"""
+ return self if isinstance(datum, dict) and {f.name for f in
self.fields}.issuperset(datum.keys()) else None
Review comment:
it is, but for record the same thing happens. Children of containers
validate their data types for themselves.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]