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

Can we come up with a better term for @entityResolver / @finder? #15

Closed
martijnwalraven opened this issue Feb 1, 2024 · 4 comments
Closed

Comments

@martijnwalraven
Copy link

The draft specification in this repository proposes the directive @entityResolver as a marker for fields that allow looking up entities by their keys. At Apollo, we've had a longstanding proposal for similar functionality where we've used @finder for the same functionality.

We discussed the term entity resolvers internally, but decided it wasn't a good match because resolvers are part of the implementation of a schema, and what we're trying to convey here is the semantics of being able to look up an entity by its key (e.g. looking up a book by its isbn or a product by its upc). We've thought about @lookup, but that didn't seem specific enough because you can look up entities by other characteristics as well (e.g. looking up all books written by a particular author).

@PascalSenn
Copy link

PascalSenn commented Feb 17, 2024

The best things i could come up with were:

  • @matcher / @match: As you match the keys to the entity
  • @join: As you join by keys (Please dont hate me)
  • @binder / @bind: As you bind a resolver for a certain set of keys.
  • @fetcher: As you "fetch" by keys. This one is not so good as it implies "fetching" but i still want to list it for documentation reasons

@smyrick
Copy link

smyrick commented Feb 20, 2024

I think the first hurdle is to strictly define what an "Entity" is though right? Do we even need to do that? If we keep with existing spec terms, an "entity" is a GraphQL Type that can be identified and resolved by specific fields (aka the @key directive today)

So would an even simpler term be something like:

You can annotate your GraphQL types with the @key directive to specify which fields should be used to resolver this object, and annotate the appropriate Query field with @typeResolver to indicate which field can resolve the data at runtime

Do we agree to use the term "entity" to indicate which types are annotated with the @key so using that term in the directive lines up?

Some other ideas:

  • @typeReference
  • @typeFetcher
  • @entityFetcher
  • @keyResolver
  • @keyResolver
  • @entityQuery

@smyrick
Copy link

smyrick commented Apr 2, 2024

Some top contenders now, small and short preferred

  • @lookup
  • @finder
  • @entity

@michaelstaib
Copy link
Member

I am closing this issue as the group has agreed to the term lookup.

#30

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

4 participants