logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.66k stars 1.24k forks source link

logical operations between global rules #4790

Open beskar-developer opened 3 weeks ago

beskar-developer commented 3 weeks ago

Is your feature request related to a problem? Please describe.

There is just pipe(&& or and) that can be applied to global rules. I sometimes need or, not, and ... operators to be applied to my rules. This comes with a lot of limitations and I must define a custom rule for each one of these scenarios and could not find another way to do it.

Describe the solution you'd like

I want the ability to write logical phrases for rules for example required||alpha (|| means or and not pipe) or required|!alpha. The syntax must improve and it is just a random thought. The object form must support something similar as well.

Describe alternatives you've considered

I did not though a lot about it and don't know what will happen for Yup, Zod, and more if this feature is added. It just seems to be right to have this feature and parsing the rules may be difficult but it worth the effort!

logaretm commented 3 weeks ago

Having full boolean expressions like with () and && is probably ruled out for the very long term since it requires a lot of work and time that I do not have.

Negation is possible but would be a breaking change, so we may need to consider it for v5.

This doesn't affect zod or yup in any way which makes it easier to add.

beskar-developer commented 3 weeks ago

Having full boolean expressions like with () and && is probably ruled out for the very long term since it requires a lot of work and time that I do not have.

Negation is possible but would be a breaking change, so we may need to consider it for v5.

This doesn't affect zod or yup in any way which makes it easier to add.

Thanks for your answer. I would be happy to contribute to this matter if it is possible.