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

Multiple objects validation #41

Closed

Conversation

micobg
Copy link

@micobg micobg commented Oct 31, 2018

Added possibility to validate multiple identical objects in array using asterisk sidn as a mask.
For object like this:

{
  "people": [{
    "name": "Mark",
    "age": 29
  }, {
    "name": "Olga",
    "age": 31
  }]
}

...or this:

{
  "people": {
    "first": {
      "name": "Mark",
      "age": 29
    }, 
    "second": {
      "name": "Olga",
      "age": 31
    }
  }
}

validation rules would be:

[
  'people' => [
    '*' => [
      'name' => v::alnum(),
      'age' => v::numeric()
    ]
  ]
]

@DavidePastore
Copy link
Owner

DavidePastore commented Nov 4, 2018

Hi @micobg ! Thanks for your effort in this PR. I'd like to ask you a thing before merge it. What do you think about this PR? It should fix the problem using the Respect/Validation native way, without using the special asterisk wildcard. Please, let me know if this PR is different and in which way.

@micobg
Copy link
Author

micobg commented Nov 12, 2018

It looks like it doing the same thing. In this case the native way is better decision. ;)

@micobg micobg closed this Dec 4, 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.

2 participants