react-jsonschema-form
react-jsonschema-form copied to clipboard
validator and customValidate both are validating fields
Prerequisites
- [X] I have searched the existing issues
- [X] I understand that providing a SSCCE example is tremendously useful to the maintainers.
- [X] I have read the documentation
- [ ] Ideally, I'm providing a sample JSFiddle, Codesandbox.io or preferably a shared playground link demonstrating the issue.
What theme are you using?
antd
Version
5.x
Current Behavior
I'm applying validation with customValidate but in that case default validator props also applying validation and validator is required props.
So cause of this i'm seeing two validation message one is coming from validator and second is coming from custom validator.
Expected Behavior
Default validator should not work if i'm using custom validation.
Steps To Reproduce
No response
Environment
- OS:
- Node:
- npm:
Anything else?
No response
This is not a bug, most users want to use customValidate to enhance the validator rather than replace it.
You could stub transformErrors to remove all of the errors provided by the validator. It looks like it runs before customValidate, so just return an empty array of errors in transformErrors and the validator errors should be removed.
For your case, I would just make transformErrors look something like this:
function transformErrors(errors, uiSchema) {
// Remove all errors reported by the validator
return []
}