devour-client
devour-client copied to clipboard
Support for hasOne relationship in url builder
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.