Skip to content
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

Make validate asynchronous #271

Merged
merged 5 commits into from
Dec 14, 2018
Merged

Conversation

JamesLMilner
Copy link
Contributor

@JamesLMilner JamesLMilner commented Nov 9, 2018

Type: feature

The following has been addressed in the PR:

Description:

At the moment validate expects a boolean return type but the ValidateHelper returns a Promise, meaning you can't use the helper in a command.

Resolves #272

@agubler
Copy link
Member

agubler commented Nov 9, 2018

Please don't merge this until we have created the v4 branch.

@@ -42,7 +42,7 @@ export type ValidationWrapper = {
};

export interface ValidateHelper {
validate(validateOpts: ValidationWrapper): Promise<any>;
validate(validateOpts: ValidationWrapper): Promise<boolean>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agubler @matt-gadd does this look like the interface we want? I was thinking about Promise<any> but I can't think if we'd want to return anything other than true or false back from a validate call. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a boolean result for validate fits

} catch (error) {
logValidateFunctionFailed(error);
noMismatches = false;
return Promise.all(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this really hard to follow, do you think we could make it clearer? Also I don't think you want to await in the map, as you just want to await the resulting array, right?

Copy link
Member

@tomdye tomdye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable

@JamesLMilner JamesLMilner merged commit b8a6866 into dojo:master Dec 14, 2018
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.

None yet

4 participants