Skip to content

Make validators and sanitizers run in the order they are specified#722

Merged
gustavohenke merged 37 commits intomasterfrom
context-stack
Jun 14, 2019
Merged

Make validators and sanitizers run in the order they are specified#722
gustavohenke merged 37 commits intomasterfrom
context-stack

Conversation

@gustavohenke
Copy link
Copy Markdown
Member

This a breaking change from previous versions.

Take this sample validation chain:

check('foo')
  .isEmail()
  .escape()
  .custom(isEmailInDatabase)

How it used to be: escape runs first, then isEmail, then the custom validator. Sanitizers would always run first (in the order they are specified among them), then validators (in the order they are specified among them).

How it will be from now on: isEmail runs first, then escape, then the custom validator. The validators or sanitizers will run in the order they are specified.

This architecture is now called "context stack", which allows us to better implement things like #500 or maybe even #658.

@coveralls
Copy link
Copy Markdown

coveralls commented Jun 14, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 5b06277 on context-stack into 5dbc6dc on master.

@gustavohenke gustavohenke marked this pull request as ready for review June 14, 2019 12:33
@gustavohenke gustavohenke merged commit 0d71a79 into master Jun 14, 2019
@gustavohenke gustavohenke deleted the context-stack branch June 14, 2019 23:44
@lock
Copy link
Copy Markdown

lock bot commented Aug 13, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants