Documented doc.validate function