-
Notifications
You must be signed in to change notification settings - Fork 48
"mandatory" and "required" field properties need to be refactored #576
Copy link
Copy link
Closed
Description
See #569 (comment)
Currently they are defined like:
mandatory- prevent nullrequired- prevent null and anything that evaluates withempty()totrue
Currently there are two major issues:
- the names are not self explanatory
- two properties does not cover all use cases (we can not allow nullable non-empty field) and the values are not always valid (when
requiredis set,mandatorycan be false and can not be used for checking if the field can benullor not) - the currently implementation does not even work like it is defined - see "mandatory" null validation is not working #575
I and @DarkSide666 propose to fix all these issues by refactoring this functionality to these fields:
notNull- if true, field can not be setnullor saved/exported whennullis set by defaultnotEmpty- if true, field can not be empty. Emptines should be evaluated to true when(string)$v === ''or for numerical types if(float)$v === 0.0.
With this proposal strings like (space) are considered non-empty. This is good to not solve multiple functionalities at once and it was so also originally as empty(' ') is evaluated to false. This should be fixed by normalization #577 which should be processed first.
These properties are very commonly used and therefore maximum care need to be provided to them.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels