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

Inconsistency between exists and required validation rule #45

Closed
girardinsamuel opened this issue Sep 28, 2020 · 3 comments
Closed

Inconsistency between exists and required validation rule #45

girardinsamuel opened this issue Sep 28, 2020 · 3 comments

Comments

@girardinsamuel
Copy link
Contributor

girardinsamuel commented Sep 28, 2020

I have found that both rules are checking that the key is present in the dict under validation.

My opinion is that :

  • those two rules must be different (otherwise no need for two rules named differently)
  • required: value must be there and not null (null here can be considered with truthy meaning)
  • exists: value must exists in the dictionary (but can be null)

If you agree with that I'll open a PR to update that, but that's a breaking change I guess.

@Marlysson
Copy link
Contributor

Plus to this quote:

required: value must be there and not null (null here can be considered with truthy meaning)

I'm trying some tests here and when validate against required rule, even if input are in request, it can be empty like that:

{"name" : ""}

Then the required rule should not passes, but actually it pass as correct.

@girardinsamuel
Copy link
Contributor Author

@Marlysson Yes indeed, thanks for reporting this.

I fixed this in PR #44, we will merge for Masonite 3.0 I guess 😉 .

@josephmancuso
Copy link
Member

Fixed in #44

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

No branches or pull requests

3 participants