Skip to content

batch lookup #181

Closed
Closed
@Finistere

Description

@Finistere

Hi! I'm from Grafbase and we're considering implementing part of this spec to support entities across our subgraphs defined with extensions (REST services, NATS, Postgres, etc.).

I've noticed that there is no notion of batching in here even though in practice we would often end up with fields like:

type Query {
  productsById(id: [ID!]!): [Product]! @lookup
}

type Product @key(fields: "id"){
  id: ID!
}

To my current understanding, the current spec only supports the following:

type Query {
  productById(id: ID!): Product @lookup
}

type Product @key(fields: "id"){
  id: ID!
}

forcing us to "batch" manually with a query like:

{
 e1: productById(id: 1) { ... }
 e2: productById(id: 2) { ... }
 e3: productById(id: 3) { ... }
}

While it works, it's definitely less efficient if a batch field exists.

From what I've seen of the current specification, It seems like @lookup could automatically be treated as a batch whenever it returns a list and it has a single argument that is a list? Any opinion? Do you have something else planned?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions