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

Filtering across relationships #10

Open
lastmjs opened this issue May 29, 2020 · 1 comment
Open

Filtering across relationships #10

lastmjs opened this issue May 29, 2020 · 1 comment

Comments

@lastmjs
Copy link

lastmjs commented May 29, 2020

See here: aerogear/graphback#1343

@danielrearden
Copy link
Contributor

danielrearden commented Jun 23, 2020

What would the API for filtering by relationships look like? It'd be easy enough to nest the Inputs:

input NoteFilter {
  id: IDInput
  title: StringInput
  ...
  and: [NoteFilter]
  or: [NoteFilter]
  not: NoteFilter
  comments: CommentFilter
}

The issue is that for one-to-many and many-to-many relationships, there's actually two different filters you might want to apply
-- 1) at least one of the related records satisfies the filter; or

  1. all of the related records satisfy the filter.

Prisma solves this by providing explicit operators to this effect.

Hasura takes a different approach and effectively puts it on the consumer to craft the appropriate query using the existing operators (see here).

I'm partial to the latter, if only because it simplifies implementation, but I can see how the former can make for a clearer API. If the spec adopts the latter approach, we should make sure to document it thoroughly.

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

No branches or pull requests

2 participants