This implements the array field discussed in #87 .
@tobyzerner a couple of things to keep in mind:
Array and List are reserved keywords in PHP and cannot be used as class names. I've temporarily used ArrayField as class name. Other possibilities are ArrayList, Arr (like Str), ... but I'm not a big fan of those either. I'll leave it up to you to decide on this.
I've only handled the validation. If you think the class should also define some other default methods like serialize(), deserialize(), etc let me know how you think they should behave. For my own use case the validation() was enough (at first glance).
The JSON pointer in errors regarding the items schema is now always the JSON pointer of the array property, while it should ideally be suffixed with /0, /1, ... (depending on the position of the item that is invalid). I didn't see a quick way to implement this, I think you may need to investigate this and adapt the error handling to deal with this.
As discussed the field injected into items() now also still requires a name. In the tests and my own app I've just used an empty string for now.
This implements the array field discussed in #87 .
@tobyzerner a couple of things to keep in mind:
Array
andList
are reserved keywords in PHP and cannot be used as class names. I've temporarily usedArrayField
as class name. Other possibilities areArrayList
,Arr
(likeStr
), ... but I'm not a big fan of those either. I'll leave it up to you to decide on this.serialize()
,deserialize()
, etc let me know how you think they should behave. For my own use case thevalidation()
was enough (at first glance).items
schema is now always the JSON pointer of the array property, while it should ideally be suffixed with/0
,/1
, ... (depending on the position of the item that is invalid). I didn't see a quick way to implement this, I think you may need to investigate this and adapt the error handling to deal with this.items()
now also still requires a name. In the tests and my own app I've just used an empty string for now.