Skip to content
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

why not use jms serializer? #753

Closed
videni opened this issue Jul 10, 2018 · 4 comments
Closed

why not use jms serializer? #753

videni opened this issue Jul 10, 2018 · 4 comments

Comments

@videni
Copy link

videni commented Jul 10, 2018

why api platform doesn't use jms serailzier? jms serializer provides more features , such as version and its faster than Symfony one.

@dunglas
Copy link
Member

dunglas commented Jul 10, 2018

For several reasons:

  • Its internal design fits more with what API Platform needs internally (chain pattern instead of visitor)
  • The Symfony Serializer benefits from the release policy, Backward Compatibility promise and time-based releases of Symfony
  • 2 people of the API Platform Core Team are also proud members of the Symfony Core Team (including me). It means that we're never "blocked", we can merge the features and fixes we need easily in the Symfony Serializer
  • JMSSerializer has been unmaintained in the past (it's not the case anymore), and it would have been a huge issue for API Platform. The truck factor for the Symfony Serializer is currently better
  • And the main historical reason: when API Platform has been started, JMS Serializer was licensed under Apache v2. This license wasn't in sync with API Platform's goals because it isn't compatible with GPLv2 (used by ezPublish, Drupal, phpBB...). The license of JMSSerializer v2 changed recently to MIT (same as Symfony), so it isn't an issue anymore

And according to the latest benchmarks, Symfony Serializer is faster, but that's not very interesting because both are very fast anyway.
Regarding features, the Symfony one has features not available in JMS Serializer (YAML and CSV support, type checking, smart property access - most of them have been contributed for API Platform actually) while JMS Serializer also has some features still lacking in the Symfony one (nicer annotations-based high level config).

To learn more about the Symfony Serializer, how it works and all its features: https://dunglas.fr/2018/05/mastering-the-symfony-serializer-php-tour-slides/

@dunglas dunglas closed this as completed Jul 10, 2018
@videni
Copy link
Author

videni commented Jul 12, 2018

@dunglas , thanks for you very detail explanation.

@babacargithub
Copy link

@dunglas you should enable to possibility to chose the serializer we want in the configuration the same way it is done in the fos rest bundle.
My existing entities were using the jms annotations such as groups, expose, MaxDepth etc
Now that my project is using API Platform I have change my annotations from JMS to Symfony Serializer which is lot of work to do

@teohhanhui
Copy link
Contributor

@babacargithub Sorry, while what you suggest sounds nice on paper, it's not feasible. We're not going to do it. This will not change in the foreseeable future.

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

No branches or pull requests

4 participants