Version Number
5.2.2
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/currying-wildflower-h472k9
Steps to reproduce
- Use the standard schema resolver with a validator that may return an error with either no path or an empty path (in my case, typia when union discrimination fails uses an empty path)
- Submit the form
- Notice how despite a validation fail occured, no errors are raised and handleSubmit calls the submit handler with an empty object
It is caused by the code correctly going down the "validation failure" code path, and returning { values: {}, errors: parseErrorSchema() }, but parseErrorSchema() starts from an empty object, iteratively adding errors to it while skipping empty paths, causing the returned error to end up as an empty object, which signals no error to react-hook-form.
Expected behaviour
Given that the path of a standard schema issue is explicitly optional in the spec, I would expect the standard schema resolver to properly handle such issue types.
Even if issues without a path are considered non-supported, at the very least, it should not return an empty object as a validated result, as that breaks the type contract of handleSubmit.
What browsers are you seeing the problem on?
Firefox
Relevant log output
Code of Conduct
Version Number
5.2.2
Codesandbox/Expo snack
https://codesandbox.io/p/sandbox/currying-wildflower-h472k9
Steps to reproduce
It is caused by the code correctly going down the "validation failure" code path, and returning
{ values: {}, errors: parseErrorSchema() }, butparseErrorSchema()starts from an empty object, iteratively adding errors to it while skipping empty paths, causing the returned error to end up as an empty object, which signals no error to react-hook-form.Expected behaviour
Given that the path of a standard schema issue is explicitly optional in the spec, I would expect the standard schema resolver to properly handle such issue types.
Even if issues without a path are considered non-supported, at the very least, it should not return an empty object as a validated result, as that breaks the type contract of handleSubmit.
What browsers are you seeing the problem on?
Firefox
Relevant log output
Code of Conduct