question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Array wildcard validation is broken

See original GitHub issue

From the docs, this example:

const data = {
  users: [
    {
      name: 'John',
      bio: {
        age: 28,
        education: {
          primary: 'Elementary School',
          secondary: 'Secondary School'
        }
      }
    }
  ]
}

const rules = {
  'users.*.name': 'required',
  'users.*.bio.age': 'min:18',
  'users.*.bio.education.primary': 'string',
  'users.*.bio.education.secondary': 'string'
}

const validation = new Validator(data, rules)

if (validation.fails()) {
  console.log(validation.errors.all())
}

It gives error:

screen shot 2017-07-21 at 10 50 08 am

The field is actually defined, but the error is given and error key is a string without array index.

Package version - 3.13.3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
vladshcherbincommented, Aug 12, 2017

@mikeerickson hey, any news on a new release?

1reaction
vladshcherbincommented, Aug 22, 2017

Fixed in 3.13.4.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wildcard Validation Rules on Collections not working #1556
From what I've found, this issue occurs with collections. @jimpeters, as your example shows, validation works as expected for arrays. However, ...
Read more >
Express-Validator 5.2.0 - Validate Wildcard Array of Objects
I am trying to validate an array of objects with express-validator. I have been using the new "wildcard" along with the "custom", ...
Read more >
Mule Expression Language Reference
This reference page for the Mule Expression Language (MEL) provides lists and brief explanations of MEL features such as operators, literals, and functions, ......
Read more >
JAXB Users Guide - Java EE
Common causes of this problem include typos, incorrect namespace URI declarations, and misunderstanding of XPath. 1.2. Fixing broken references in schema.
Read more >
Array validation is not working. Am I doing something wrong or ...
I am trying to use the array validation feature in Laravel 5.2 but finding an issue. I am not sure if it is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found