-
Notifications
You must be signed in to change notification settings - Fork 112
Add field projection to sub-resource/referenced resource queries. #215
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
Conversation
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.
LGTM
@rs, does this make sense to you? The main use-case is to make the projection available to hooks, so that e.g. a permission system could error when the user access fields he is not allowed to.
Storer interface implemeters.
As an FIY, this is currently storngly discouraged in the docs.
From https://godoc.org/github.com/rs/rest-layer/resource#Storer:
A storer must ignore the Projection part of the query and always return
the document in its entirety. Documents matching a given predicate might
be reused (i.e.: cached) with a different projection.
Okay, I may remove that part of the commit message. |
9793924
to
0dd9cb4
Compare
I think the doc is still relevant for storers. It can make sense for hooks to evaluate projections though. |
Guys, pressed |
Yes, let's merge it -- but I need you to do a final rebase before I am allowed to merge it, can you do that? |
0dd9cb4
to
571d5c4
Compare
2ce9346
to
571d5c4
Compare
571d5c4
to
d3461c4
Compare
These potentially can be used in
resource hooks
andStorer
interface implemeters.No tests breakage. No new test cases added, since I couldn't find this functionality tested in current tests. May add some tests about these in the future.