strawberry.relay.Node

Node interface for GraphQL types.

Subclasses must type the id field using NodeID . It will be private to the schema because it will be converted to a global ID and exposed as id: GlobalID!

The following methods can also be implemented: resolve_id: (Optional) Called to resolve the node’s id. Can be overriden to customize how the id is retrieved (e.g. in case you don’t want to define a NodeID field) resolve_nodes: Called to retrieve an iterable of node given their ids resolve_node: (Optional) Called to retrieve a node given its id. If not defined the default implementation will call .resolve_nodes with that single node id.

Example:

import strawberry
@strawberry.type
class Fruit(strawberry.relay.Node):
id: strawberry.relay.NodeID[int]
name: str
@classmethod
def resolve_nodes(cls, *, info, node_ids, required=False):
# Return an iterable of fruits in here
...

Methods: