You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a service boundary in our application but want to represent the JSON:API relationship. Relationships from within the service might be "includable", whereas relationships where another endpoint or service own the resource might not be.
Let's say we have a CMS service that hosts our actual articles, but a separate service that really owns user information (authentication, authorization, profile data, etc.). Each article in the CMS would likely still have an author_id.
Using JSON:API. We'd still want to represent that as a relationship in a response from /articles, but we may never want to be able to include the full resource since its owned by another service.
It would be great to be able to make one request to something like /articles and see the relationship even though we have to make a subsequent request to get the actual people record
It would be helpful to be able to represent a relationship without exposing the ability to include that resource. Perhaps we could have the ability to hide the related view or to otherwise include the relationships portion of the payload without serializing the resource on the includes portion of the response.
The text was updated successfully, but these errors were encountered:
We could also potentially solve the problem by allowing the relationship name to be overridden similarly to how fields are in the view.
Override author relationship in the view
def author(article, _conn) do
%{ id: article.author_id }
end
It would also be good to be able to potentially disable including the data but still reflect the relationship, but that looks like a bit of a refactor by comparison.
This is similar to some thinking reflected here:
We have a service boundary in our application but want to represent the JSON:API relationship. Relationships from within the service might be "includable", whereas relationships where another endpoint or service own the resource might not be.
I'll base an example off of the JSON:API example here: https://jsonapi.org/examples/
Let's say we have a CMS service that hosts our actual articles, but a separate service that really owns user information (authentication, authorization, profile data, etc.). Each article in the CMS would likely still have an author_id.
Using JSON:API. We'd still want to represent that as a relationship in a response from
/articles
, but we may never want to be able to include the full resource since its owned by another service.It would be great to be able to make one request to something like
/articles
and see the relationship even though we have to make a subsequent request to get the actual people recordIt would be helpful to be able to represent a relationship without exposing the ability to include that resource. Perhaps we could have the ability to hide the related view or to otherwise include the
relationships
portion of the payload without serializing the resource on theincludes
portion of the response.The text was updated successfully, but these errors were encountered: