Fixed Validation error when creating custom fields' default values #11724
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.
Description
When a user creates custom fields, they can mark such fields as required. Then they can create fieldsets to customize the existent models. Then they can set default values for this custom fields, but when creating those default values we apply a validator so later when creating assets using that model, the default values are valid.
But it can be the case that the user doesn't want to put a default value to every custom field, and if the field is marked as required, then any of the default values can be assigned. This PR eliminates the rule 'required' on fields that have it, so it only apply the format requested by the user.
It doesn't affect the integrity of the system as this changes are at the Asset model level, so when a new asset using this model is actually created, the required rules are still validating the data.
I still have to find a way to not lose every default value when the validator fails, because in the case there's a lot of custom fields it can be tiresome to fill all the data everytime. But it's a little step in making this feature a little more usable.
Fixes freshdesk #30229
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: