-
Notifications
You must be signed in to change notification settings - Fork 12
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
list related resources #140
Conversation
ccc0df3
to
bb7845e
Compare
I think I would like to see a way to get the things in a specific relationship. So I'm not 100% sure when we would want to use this API though, so what are you thinking there? |
That makes sense. With the limitations of spicedb's query requiring a Resource Type, we would have to loop through all possible resource types and fetch each individually and then combine the outputs. But this is something we're already doing for role deletions as well. |
@nicolerenee Is your thinking here that we provide a URL path component/query parameter describing the relation itself? For example, if we have a schema that looks like so:
We would then have a URL like |
@jnschaeffer yeah, that's exactly what I'm thinking. Usually if I'm trying to get the relationships of something I would imagine I'm trying to get a specific one. But I guess the question is what are we wanting this URL for? |
bb7845e
to
2af13a2
Compare
Expose endpoints to list related resources From and To a given resource. Signed-off-by: Mike Mason <[email protected]>
2af13a2
to
84fab14
Compare
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.
Looks good at a glance - one question though.
v1.GET("/resources/:id/relationships", r.relationshipListFrom) | ||
v1.GET("/relationships/from/:id", r.relationshipListFrom) |
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.
Are we keeping the existing API endpoint so as to not break compatibility?
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.
Yeah, no real reason other than that.
Expose a method to list resources related to a given resource.
Fetching
/relationships/from/:resource_id
will return relationships directly assigned to this resource.Fetching
/relationships/to/:resource_id
will return relationships for resources which have a relation to this resource.