auraphp / Aura.Filter

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

JsonSerializable #120

Closed designermonkey closed 8 years ago

designermonkey commented 8 years ago

I've just come across a great scenario where I need to get all of the failure data as json for a vue.js component to take over.

Would it be a good idea to implement JsonSerializable in the Failure class?

harikt commented 8 years ago

Do you mean to validate json ? Something like https://github.com/Seldaek/jsonlint ?

designermonkey commented 8 years ago

No, I mean so that we can just use


$json = json_encode($validator->getFailures());

Currently it returns a FailureCollection of Failure objects. It would be great if it could just be serializable as json from the objects.

designermonkey commented 8 years ago

Here is the spec for the interface: http://php.net/manual/en/class.jsonserializable.php

pmjones commented 8 years ago

@designermonkey That seems like a straightforward change. Send a PR for that and I'll review.

designermonkey commented 8 years ago

ok (hopes I get some time to myself to do it asap) :)

harikt commented 8 years ago

As this is fixed with #121 . Closing the issue.