voku / Arrayy

🗃 Array manipulation library for PHP, called Arrayy!

Home Page:https://voku.gitbooks.io/arrayy/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validate array based on a schema

szepeviktor opened this issue · comments

What is this feature about (expected vs actual behaviour)?

Provide a schema a check validity of/fix an array.

@voku Do you happen to know a package that does this? Do you plan to implement it?

Sounds interesting, what kind of schema did you think of?

I'm not ready with the answer!
JSON schema seems to be popular but it is complex.
As far as I can see it needs only key type, value type and is_required.
...for trees and multidimensional arrays too

are you talking about json validation?

Yes. But not exclusively.

php has a json_validate function in its latest version ..fixing things for minor version does not make sense i guess..

@rcsofttech85 json_validate only validates the JSON, not the data in the JSON

@szepeviktor It's already possible to validate / extract multidimensional data from JSON e.g.

$json = '[{"id":1,"firstName":"Lars","lastName":"Moelleken","city":{"name":"Düsseldorf","plz":null,"infos":["lall"]}}, {"id":1,"firstName":"Sven","lastName":"Moelleken","city":{"name":"Köln","plz":null,"infos":["foo"]}}]';