* chore: update ash to use Ash.Type.Enum descriptions
Contextually, remove an unreachable clause that caused dyalizer to fail,
see https://github.com/ash-project/ash/pull/873 for the commit that made
it unreachable
* feat: allow providing descriptions for enum values
If the module exports `graphql_describe_enum_value/1`, use that. Otherwise,
fallback to the Ash.Type.Enum value descriptions introduced in
https://github.com/ash-project/ash/pull/940.
Close#116
* chore: regenerate formatter and cheatsheets for paginate_with
* chore: fix credo errors
Use pattern matching to remove an if level and invert the logic on the
if Credo was complaining about
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>
* improvement: make mutation arguments non-null
As discussed in #105 and #110, put this behind an opt-in configuration to avoid
breaking existing code.
The ID in update mutations is always non-null if non-null mutation arguments are
allowed, while input is non-null if it's allowed _and_ there is at least a
non-null field in the input.
Document the newly added config variable in the getting started guide.
* chore: enable non-null mutation arguments in tests
Adjust rool level error tests: since result is now non-nullable, if the content
of the result is nil, the whole result becomes nil. Note that this is not a
breaking change since GraphQL always allows a field nullability to propagate
upwards in case of a field error (see October 2021 spec, section 6.4.4).
Slight API improvement over #106.
This makes it more ergonomic to partially match on the return value (and it also
makes it more explicit by explicitly labeling the two parts).
Also add tests for relay id encoding/decoding.
* 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.