Explicitly set nullable validation rule #581
Merged
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.
Currently, Blueprint does not explicitly set the
nullable
validation rule fornullable
columns. This means the generated form request requiresnullable
columns to be set or not in the request data at all.For example, a
published_at
date column which is nullable would generate the validation rule['date']
. As such, attempting to set thispublished_at
column tonull
would cause validation to fail. That is not the expected behavior for a nullable column.Originally, the thought was the columns you passed to a
validate
statement should all be "required". While that is the common case, it's assuming (too fancy).I now think adding the
nullable
validation rule to database columns which arenullable
generates an expected set of ready-to-use validation rules. If the developer knows a nullable column is always present in the request or should not benull
for that form, then it's easy to change torequired
.Closes #431