Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is another "refactored" version of this PR
Here I tried to follow the current logic and add a Validator.
The current problem I encountered is that validators get executed only if the property is set.
By adding a
Nullable
property, we need to make sure thatTypes
does not complain anymore aboutnil
values. This goes against the current logic and current tests suit, which assumes thatnil
should not be allowed a valid value for the defined types.So, there is a decision to be made here:
nil
and let nullable to do the check ifnullable
is set => By default nil is accepted as a value, especially if nullable is not setnil
as a valid value, but add somehownullable: false
by defaultWhy do we want to allow Types to have
nil
value? Because validators are independent, and ifnullable
is set to true, we do not wantTypes
to complain related tonil
values.Maybe there is another option I'm not considering, let's discuss further :)