mathematic-inc / ts-japi

A highly-modular (typescript-friendly)-framework agnostic library for serializing data to the JSON:API specification
Apache License 2.0
202 stars 15 forks source link

[BUG] Polymorphic serialiser is grouping results by resource type #92

Closed janders4 closed 4 months ago

janders4 commented 4 months ago

Describe the bug*

The Polymorphic serialiser is changing the order of results, grouping them by resource type. This causes problems when using the serialiser to perform actions such as searching where the original order of the results represents the strength of the search hit.

To Reproduce*

  1. Implement a polymorphic serialiser
  2. Perform a query that will return multiple resource types
  3. Have your application provide the results to the serialiser not already grouped by resource type

Expected behavior*

The serialiser should honour the order of the resources or provide an option to maintain order

Platform*

* means required.