-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support renaming of relationships #270
Support renaming of relationships #270
Conversation
… not passing yet.
…relationship config into one helper
893b11a
to
cd7863e
Compare
cd7863e
to
bb84ce0
Compare
Thanks for the PR @mattpolzin! I'll spend some time today reviewing this but at a quick glance this looks good and has test coverage 🎉 |
I think I'll merge this soon and start working on release notes for a new release (there will have been a solid chunk of changes, not just this PR) if no one comments to say they are going to leave a review in the near future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR introduces the ability to rename relationships in the JSONAPI View.
Other changes in this PR are mostly to rename a few variables local to functions where I felt that it served clarity (like
view
->parent_view
).Similar results can be achieved for attributes by writing custom functions of the same name as the attribute being exposed. I considered adding relationship renaming in a similar fashion, but I believe that with relationships you gain more by not needing to dig into the model and produce the relationship yourself than with attributes and at the same time there is less benefit to writing an entire function (I am not aware of use-cases beyond renaming the relationship that would benefit from this other than fabricating relationships that are not represented in the underlying data-source).
As a side note, fabricating relationships is supported as-is with the feature this PR provides, but it feels like an unusual enough desire to not document explicitly in the readme.