-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add extendValidator
#12738
base: main
Are you sure you want to change the base?
feat: add extendValidator
#12738
Conversation
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/reactivity
@vue/compiler-ssr
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
I'm afraid this would be a breaking change as returning a non-empty string used to mean validation success. I like the idea and would love for Vue to include a built-in solution that allows developers to leverage existing utilities for handling prop validation errors. To be honest, I’ve always thought the custom validator should be named |
Thanks for your reply.
Yes, this is indeed a problem.
IMO, renaming existing properties will have a big impact. To avoid afferting users, we should either add a new method to customize the validation rules, or add a new parameter to the existing validator function for special handling.
Would you like me to create an issue in the RFC repository first? |
I'm not suggesting renaming, but add a new alternative with enhanced behavior. And I believe a separate RFC thread is necessary. |
Sorry, I misunderstood what you meant.
link vuejs/rfcs#739 |
I prefer to extend the parameters based on validator to control its behavior, and reduce the generation of new APIs while ensuring compatibility. Too many APIs are not necessarily a good thing. 🧐 |
Yeah, at first I just wanted to simply expand the warning message, so I created this PR in a rough way. After discussing with @jacekkarczmarczyk, I am still a little undecided about how to implement this requirement. Maybe we need to discuss it together and confirm it. |
Sometimes the type matches but the range does not match. I hope to give a clearer and more explicit error prompt.