auraphp / Aura.Filter

Validate and sanitize arrays and objects.
MIT License
159 stars 33 forks source link

best way to validate each item in array #136

Closed MarcusFulbright closed 6 years ago

MarcusFulbright commented 6 years ago

Say I have a $subject like this:

$subject = [
  'field' => 'value'
  'array_field' => [
    1,
    2
  ]
];

What is the best way to create a $filter that will ensure that field is a string and that array_field only contains integers?

Currently I'm using a custom callback function. Is there a better way?

jakejohns commented 6 years ago

Your callback is likely the best solution currently. #117 has some discussion on dealing with arrays as properties of subjects in various ways. Also, #131 has some attempt to start actually addressing it.

MarcusFulbright commented 6 years ago

ah cool. I think this can be closed then.