Skip to content

Conversation

bertramakers
Copy link
Contributor

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.

@tobyzerner
Copy link
Owner

This has been merged in e1c6901

@tobyzerner tobyzerner closed this Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants