module T::Props::Utils

def self.need_nil_read_check?(prop_rules)

This is mostly for the compatibility check that we allow existing documents carry some nil prop/field.
The prop_rules indicate whether we should check for reading a nil value for the prop/field.
def self.need_nil_read_check?(prop_rules)
  # . :on_load allows nil read, but we need to check for the read for future writes
  prop_rules[:optional] == :on_load || prop_rules[:raise_on_nil_write]
end