nilportugues / symfony-jsonapi

JSON API Transformer Bundle for Symfony 2 and Symfony 3
http://nilportugues.com
MIT License
115 stars 19 forks source link

ordering of attributes in the output #7

Closed mmucklo closed 8 years ago

mmucklo commented 8 years ago

Is there anyway to sort the attribute keys before outputting them (or at least have the option to do a sort)?

The reflection does seem to pick out the properties "in order" from the Class file, however if you have a sub-class it can be difficult then to keep things strictly alphabetical, especially if there are attributes defined in both files.

nilportugues commented 8 years ago

This is definately one configurable parameter I could make available in the configuration. Nice idea.

While it adds little value to the data transformation or data consumption by a client, I understand pretty output is something craftmen take into account when choosing a package ;)

nilportugues commented 8 years ago

@mmucklo ordered by ksort since https://github.com/nilportugues/symfony-jsonapi/releases/tag/1.5.0 because of https://github.com/nilportugues/php-json-api/releases/tag/2.3.0

Ordering will be always consistent now.