Relationship array of different types - jsonapi-serializer

We have a requirement to accept a customer order for which we need to know a set of related customs registrations. In JSON-API terms, we’ve defined it as an array of relationships, looking like this:-

"relationships": {
  "customsRegistrations": {
    "data": [
      {
        "type": "EORI",
        "id": "GB0987654321"
      },
      {
        "type": "VAT",
        "id": "1234567890"
      }
    ]
  }
}

Having different types within one relationship array seems to be valid and has been previously discussed here.

However, when we use the JSON-API Serializer, the “type” attribute becomes a class name, which doesn’t work when you have different types in an array. The example above would want to come out something like this:-

public class CustomsRegistrations
{
    public List<EORI> EORIs { get; set; }
}

public class EORI
{
    public string Id { get; set; }
}

Which is right? The JSON-API spec seems to say that multiple types are allowable, so is the JSON-API Serializer not compliant with the spec?

Thanks,

J.

Found it. A closer reading of the documentation reveals that it’s as simple as declaring a “type” property within the class.