-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add functionality for Explicit Parsing #86
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sold on the approach here. The handlers are meant to be serializers. Ideally we should match Laravel's cast handlers.
For example, you don't appear to have any handling for cases where the value isn't compatible with the assigned handler, which could be problematic. Would be better to cast the values into whatever format prior to the serialization handler, so that it picks the right one.
I could add a config option there, to choose between fallback handling or throwing an exception. Would you like an addition like this? |
I'm proposing separating the casting and serialization steps. That way you can cast or validate any value into any format, and only after this will the appropriate serializer be selected automatically based on the resulting format, so there shouldn't be any conflicts. |
I have in mind two different cases:
On both cases, with the existing functionality, each value needs to be parsed twice. PS: Next Major version, Handlers could implement |
An approach to enforce explicit
DataTypes
on metaPlease any feedback will be appreciated, and of course any change to fit in the package standards
Todo:
closes #85