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: pass options.names
as a second argument to a Vest suite
#584
feat: pass options.names
as a second argument to a Vest suite
#584
Conversation
Thanks for the contribution. Can you add an unit test for this new option? |
06c86ac
to
593866e
Compare
Added a test with expected behavior. |
Thanks for the test. The type should be updated as well: https://github.com/react-hook-form/resolvers/blob/master/vest/src/types.ts#L12 |
The linked line is one that I made note of. It is unused and can be removed, but this is a breaking change, I assume. There is no change in types, because all arguments are the same. Currently vest suite signature is undefined. It is simply |
593866e
to
745f68e
Compare
Ok, if it is allowed then it makes sense to type the expected call signature of a vest suite. I think this one is reasonable: (values: TValues, names?: FieldName<TValues>[], context?: TContext) => void So pass names as the second argument (such signature is shown many times in Vest documentation, mostly for passing to |
Thank you for your contributions! This Pull Request has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Best, RHF Team ❤️ |
Any thoughts? |
I tried your code locally, everything seems to work as expected without any breaking changes. |
Sounds good to me 👍 @jorisre |
There is a PR here as well: react-hook-form/react-hook-form#10590 |
FYI @bluebill1049 I merged but I'll release later with others fixes |
🎉 This PR is included in version 3.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
React Hook Form has a way to signal to a resolver for which fields validations were requested (
options.names
/options.fields
) and Vest has a way to skip unrequested validations (only
/skip
/include
). But currently that names information gets discarded and Vest cannot utilize that functionality. I think it makes sense to pass names as a second argument.Note:
vestResolver
has a second argument which is and never was utilized, other adapters do not have such thing. I think it should be put on note somewhere for removal in next major release.