Extract safeGetPath out of validateRequiredProperty

/cc @jwswj