-
I'm looking at the documentation at https://uniforms.tools/docs/api-forms/#asynchronous-validation It seems that I'm making a call to my API to do my async validation and if it fails, it's not clear to me how to pass that response back to the form. I also looked at ajv's recommended approach (https://ajv.js.org/guide/async-validation.html), but couldn't get it working in my bridge. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi @chiester. As with all errors in uniforms, the format of the error is specified by the bridge you're using. So, if you're using JSON schema bridge (I assume so, based on the ajv in your message), you have to return a list of
In
You don't have to use I hope this answers the question. If not, please do let me know. |
Beta Was this translation helpful? Give feedback.
-
Hi I'm also battling with this. Again. Can we please have noted the exact schema of error object somewhere in documentation? Thanks |
Beta Was this translation helpful? Give feedback.
Hi @chiester. As with all errors in uniforms, the format of the error is specified by the bridge you're using. So, if you're using JSON schema bridge (I assume so, based on the ajv in your message), you have to return a list of
ErrorObject
-like objects. (I sayErrorObject
-like, as we're not using all of the properties. You can always check thegetError
implementation to see the details.)In
onValidate
, you are supposed to return a new error, not modify the one you received. So, for example, in JSON schema, simply add your custom errors to thedetails
array. To make them visible with theshowInlineError
, make sure that theinst…