I’ve been mulling this question for a while, and I don’t really see a good way to deal with it any other way than to allow resources that do not have an application/vnd.api+json representation.
Let’s say I have a resource that represents an attachment to an email message, of type
attachment. This has a variety of fields, and is reasonably represented using application/vnd.api+json. But there are additional “resources” that are related to this that have no JSON:API representation, such as the raw content of the attachment, which could be anything, or an extracted plain text representation (of type text/plain).
I’d originally thought I could just add additional members to the
links structure for the
attachment resource, but I don’t think that’s valid in JSON:API 1.0. For JSON:API 1.1, it looks like Extension Relation Types could be used, but would be quite verbose, and I know my front-end developers would rebel.
So, my question:
Would it be reasonable for
attachment resources to include relationships (perhaps
plaintext in this example), with only the
related link, which would respond with the appropriate non-application/vnd.api+json content?