-
Notifications
You must be signed in to change notification settings - Fork 152
Contract for JSON encoding/decoding #161
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
Conversation
In a nutshell, I'm for alternative solution 1 - keep the Introducing a Using virtual types is even more complex. I find that solution harder to understand as I would need to search di.xml to seem which options are set for a given type. It also puts additional weight on developers because they have to understand virtual types, arguably one of the more complex areas of object manager configuration. Keeping things simpler is usually better. Personally I still will probably continue to use PHP native |
I agree with @Vinai we should continue to use PHP native |
@Vinai @fooman @larsroettig @navarr @elevinskii |
I cannot attend the June 5th meeting due to prior engagements. A summary of my standpoint is:
|
I can also not attend but here my standpoint: JSON is often used by Frontend developer to exchange Data with the Frontend. As navarr mention, it is additional overhead to warp JSON I don't see a benefit for wrapping it. |
I can attend the meeting. |
Removing SerializerInterface has been mentioned during the meeting - I don't think that's a good idea. There are situations where we just want to store complex data as a string and restore it later and we don't care for the format, for instance caching config values. If there's a problem with developers expecting SerializerInterface always to be Json we can remove the default preference and make developers to make a choice explicitly. Regarding json options - would it be a bad things to add 'encrypt' and 'decrypt' methods to Json class? |
@AlexMaxHorkun Making the cache serialization format explicitly JSON enables the creation of tooling. Data is valuable, even in cache. No benefit in hiding the serialization format behind a Regarding |
I also favor Other Possible Solutions - point 1. Mostly from extension developer point-of view:
|
With option 1 I have small concern that options passed for one implementation may not be applicable or will cause unpredicted behavior for other implementations. This is why I like option 2 more. |
My mistake, I meant encode/decode. Do we expect anybody creating child classes of Json serializer? If not I think adding optional parameters is good enough solution, albeit slightly messy one |
Problem
The use of JSON data format might be wider than just serialization and current
Magento\Framework\Serialize\Serializer\Json
does not cover all those needs.Solution
New contract for JSON encoding/decoding.
Requested Reviewers
@maghamed
@Vinai
@fooman
Related Discussion
magento/magento-coding-standard#91