FieldOption isRequired

This option is used to define that a field is not optional and must always be filled, add the option isRequired. The value of the option should remain blank.

If the option has been added to at least one field of a data element, the expander will generate a body for the checkRequired() method in every projector which is generated for that data element. By default when the option is not defined, this method always returns CrudsResult.success().

The checkRequired() method in the details projector will be called after the custom pre-create code in the create() method of the data element’s cruds class, to verify that all required fields are present in the given data object. In that class’ modifyWithProjection() method, the checkRequired() method is also called on the specified projector. These calls to checkRequired() are only generated in the code if at least one fields of the data element implements this option.