Building upon #110, this restores the old behaviour of the result being nullable
when root level errors are present.
While the result is guaranteed to not be nullable in standard conditions (since
either result or errors are always present), when errors are moved to the root
level it could become null, so declaring it non-nullable propagates the null up
to the data field.
This actually causes compatibility problems with some client libraries (e.g.
Relay) that expect the inner result to be null, _not_ data, if there's an error.
This also adds dedicated RootLevelErrors versions of the Api and the Schema
since the configuration is accessed at compile time now, so put_env was not
enough to test them correctly.
Adds a new option for queries and mutations that defines which arguments or
attributes will use a global Relay ID and their type. This allows automatically
decoding them before hitting their action.
This paves the way to automatic translation derived from the arguments, which
will be implemented subsequently.
---------
Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
* 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.
An error occurs at compile time:
== Compilation error in file test/support/schema.ex ==
** (MatchError) no match of right hand side value: {:error, "Must provide field type for max"}
lib/resource/resource.ex:2278: AshGraphql.Resource.filterable?/2
(elixir 1.15.4) lib/enum.ex:4265: Enum.filter_list/2
(elixir 1.15.4) lib/enum.ex:4266: Enum.filter_list/2
lib/resource/resource.ex:2229: AshGraphql.Resource.aggregate_filter_fields/2
lib/resource/resource.ex:2195: AshGraphql.Resource.resource_filter_fields/2
lib/resource/resource.ex:1159: AshGraphql.Resource.args/5
lib/resource/resource.ex:425: anonymous fn/6 in AshGraphql.Resource.queries/5
(elixir 1.15.4) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
metadata on read actions is merged with the rest of the fields on the query, so must have a name unique from the attributes/calculations/aggregates.
The system will warn you if there is metadata on the underlying action that is being ignored, and will tell you how to fix it.
improvement: add `start_keyset` and `end_keyset` to `keyset_page_of` type
improvement: add `count` to relay fields if there exists a countable relay query