devour-client icon indicating copy to clipboard operation
devour-client copied to clipboard

Support for hasOne relationship in url builder

Open mdenomy opened this issue 9 years ago • 0 comments

Right now I don't see how I can use the url builder to get the url for a resource of hasOne relationship. For instance, if an author has one bio, I would expect the url (for author id 1) to be authors/1/bio.

I would like to get this url via the url builder methods by doing something like jsonApi.one('authors', author.id).only('bio').get();.

In the meantime, I can get around this by defining a collectionPath for bio of bio, and doing 'jsonApi.one('authors', author.id).all('bio').get() but that feels like a bit of a hack.

I'd be happy to do the work on this, but wanted to see if you thought it was worthwhile before pursuing it. Also not sure how this might relate to https://github.com/twg/devour/issues/46.

mdenomy avatar Sep 07 '16 12:09 mdenomy