Skip to content

Multiple objects validation#41

Closed
micobg wants to merge 3 commits into
DavidePastore:masterfrom
micobg:multiple_objects_validation
Closed

Multiple objects validation#41
micobg wants to merge 3 commits into
DavidePastore:masterfrom
micobg:multiple_objects_validation

Conversation

@micobg

@micobg micobg commented Oct 31, 2018

Copy link
Copy Markdown

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

DavidePastore commented Nov 4, 2018

Copy link
Copy Markdown
Owner

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

micobg commented Nov 12, 2018

Copy link
Copy Markdown
Author

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