mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-21 13:53:20 +12:00
365b3aedc6
* feat: add support for relay global IDs * improvement: use the GraphQL type when projecting fields This allows picking also up fields coming from fragments in queries returning an interface * feat: add relay node query Allow retrieving a resource implementing the Node interface given its Relay global id.
27 lines
717 B
Markdown
27 lines
717 B
Markdown
# Relay
|
|
|
|
Enabling relay for a resource sets it up to follow the [relay specification](https://relay.dev/graphql/connections.htm).
|
|
|
|
The two changes that are made currently are:
|
|
|
|
* the type for the resource will implement the `Node` interface
|
|
* pagination over that resource will behave as a Connection.
|
|
|
|
## Using with Absinthe.Relay
|
|
|
|
Use the following option when calling `use AshGraphql`
|
|
|
|
```elixir
|
|
use AshGraphql, define_relay_types?: false
|
|
```
|
|
|
|
## Relay Global IDs
|
|
|
|
Use the following option to generate Relay Global IDs (see
|
|
[here](https://relay.dev/graphql/objectidentification.htm)).
|
|
|
|
```elixir
|
|
use AshGraphql, relay_ids?: true
|
|
```
|
|
|
|
This allows refetching a node using the `node` query and passing its global ID.
|