mathematic-inc / ts-japi

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

[FR] Support polymorphic relationships #65

Closed egmacke closed 1 year ago

egmacke commented 1 year ago

Is your feature request related to a problem? *

Sometime a relationship may be polymorpic. For example, the relationship of vehicle could be a Car or a Lorry.

Currently there is no way to provide different relationship serializers based on the value of the relationship.

Describe the solution you'd like*

When defining the relator serializer, it would be good to be able to pass a collection of serializers with a discriminator field.