I think this should be permitted by the JSON API spec, and the input validator permits it, but throws an error when attempting to access the relationship.
To Reproduce
An API defined on a domain:
json_api do
prefix "/api"
routes do
base_route "/artists", Tunez.Music.Artist do
get :read
index :search
post :create
patch :update
delete :destroy
related :albums, :read, primary?: true
end
end
end
The Tunez.Music.Artist resource:
json_api do
type "artist"
includes [:albums]
end
relationships do
has_many :albums, Tunez.Music.Album do
public? true
end
end
The Tunez.Music.Album resource:
json_api do
type "album"
includes [:tracks]
end
relationships do
has_many :tracks, Tunez.Music.Track do
public? true
end
end
Describe the bug
I think this should be permitted by the JSON API spec, and the input validator permits it, but throws an error when attempting to access the relationship.
To Reproduce
An API defined on a domain:
The
Tunez.Music.Artist
resource:The
Tunez.Music.Album
resource:The
Tunez.Music.Track
resource:Trying to access a URL like the following:
http://localhost:4000/api/artists/{artist_id}/albums?include=tracks
(Including tracks for an artist's albums)
Generates an error:
It does return valid JSON to the client, but possibly with too much information:
Expected behavior
The tracks should be returned as part of the
relationship
data, ie.(This is without
include=tracks
)Runtime
Additional context Add any other context about the problem here.