Add required field only for OneToOne and ManyToOne field types.

This ensures that the 'required' is not present for OneToMany
and ManyToMany fields, since they do not have any optional
semantics.