Skip to content
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

Merged
merged 9 commits into from
Jan 14, 2023

Conversation

mattpolzin
Copy link
Member

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.

@mattpolzin mattpolzin requested a review from a team as a code owner June 10, 2022 22:06
@doomspork
Copy link
Member

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 🎉

@mattpolzin
Copy link
Member Author

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.

README.md Show resolved Hide resolved
Copy link
Contributor

@snewcomer snewcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mattpolzin mattpolzin merged commit c9ed4bb into beam-community:main Jan 14, 2023
@mattpolzin mattpolzin deleted the relationship-rewrite branch June 23, 2023 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants