Validate an optional object.
The value to validate
Dot-notation path for error messages
The object or null
Validate an optional object.