Skip to content

[Question] Async validation: what has to be returned? #1023

Answered by radekmie
chiester asked this question in Q&A
Discussion options

You must be logged in to vote

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 say ErrorObject-like, as we're not using all of the properties. You can always check the getError implementation to see the details.)

What is the correct way to modify the errors to return them?

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 the details array. To make them visible with the showInlineError, make sure that the inst…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@chiester
Comment options

@radekmie
Comment options

Answer selected by radekmie
Comment options

You must be logged in to vote
1 reply
@wadamek65
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #1020 on September 13, 2021 15:06.