Reworked Required and OmitEmpty #8
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "KN4CK3R/binding:feature-ignore-empty"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The old behaviour is inconsistent because this fails:
Here you need
OmitEmpty
even if the field is not required.The new logic:
In short: Rules are skipped if a field is empty and not required. Thats the normal behaviour in other validation libraries like Yup too.
After this change there are some places in Gitea where we can add form validation to optional fields which is not possible at the moment. Possible changes in:
21465a2ce3/modules/structs/admin_user.go (L31)
21465a2ce3/modules/structs/admin_user.go (L35)
21465a2ce3/modules/structs/org_team.go (L38)
21465a2ce3/modules/validation/binding.go (L90)
21465a2ce3/modules/validation/binding.go (L108)
Please resolve the conflicts.
I see no conflicts? There was a conflict which should be resolved with the merge of the master branch some hours ago.
It maybe a bug of Gitea, when update, it displays below error.
@KN4CK3R can you rebase or update this pull please?