Specify fieldset for included relationship of the same resource type

Hello.

According to JSON API spec documentation - you can provide list of fields to fetch for specific resource type. But what if I have a relationship of the same type but I want only specific fields of these object while having all fields for non relationship objects?

Example:

I have a “note” resource, which has “previousNotes” relationship which is also “note” resource

I am doing request in following way:

/notes?include=previousNotes

But the thing is, that I want all fields of notes but only title attribute for previousNotes

And according to documentation, I can add fields[notes]=title to the url. But this way both notes and previousNotes will have only title attribute in response because they are both same resource type.

Is there a way to specify fieldset not for whole resource type but for specific relationship(which is specified in include)?

The base specification only supports sparse fieldsets per resource type as you mentioned. But you could use an extension adding support for sparse fieldsets depending if the resource is included as primary data or included.