Skip to content

support async (promised) validators #171

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

Merged
merged 1 commit into from
Mar 28, 2017
Merged

support async (promised) validators #171

merged 1 commit into from
Mar 28, 2017

Conversation

icebob
Copy link
Member

@icebob icebob commented Mar 28, 2017

Handle async validator which returns with Promise. Discussion: #170

Example async validators in dev:

let customAsyncValidator = function(value) {
	return new Promise((resolve, reject) => {
		setTimeout(() => {
			if (value)
				resolve();
			else
				resolve([ "Invalid value from async validator" ]);
		}, 1000);
	});
};

Schema:

{
	type: "input",
	inputType: "url",
	label: "URL",
	model: "website",
	validator: customAsyncValidator
}

TODO:

  • add tests

@cristijora
Copy link
Collaborator

Nice. @jmverges take a look :)

@jmverges
Copy link
Contributor

@icebob works properly for me, thank you!

@icebob
Copy link
Member Author

icebob commented Mar 28, 2017

Great! You're welcome.

@icebob icebob merged commit 806080e into master Mar 28, 2017
@icebob icebob deleted the async-validators branch March 28, 2017 19:09
@icebob icebob mentioned this pull request Mar 29, 2017
5 tasks
@icebob
Copy link
Member Author

icebob commented Apr 4, 2017

Released in v2.0.0-beta6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants