Commit graph

613 commits

Author SHA1 Message Date
Zach Daniel
22034fd47a chore: credo 2024-02-11 14:41:24 -05:00
Zach Daniel
328618fa94 fix: handle unions containing maps and vice versa 2024-02-11 14:10:20 -05:00
Riccardo Binetti
70eae5f421
fix: make results nullable again if root level errors are enabled (#114)
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.
2024-02-09 09:36:23 -05:00
Barnabas Jovanovics
c82512d70a
* improvement: support data layer functions (ilike, like) (#113)
---------

Co-authored-by: Zach Daniel <zach@zachdaniel.dev>
2024-02-09 09:03:10 -05:00
Riccardo Binetti
66d2f44443
feat: add Relay ID translation in mutation and queries (#109)
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>
2024-02-06 09:46:09 -05:00
Zach Daniel
d00ae4e315 fix: define map input types w/ nested input types 2024-02-05 13:48:22 -05:00
Zach Daniel
099540c79e fix: handle nested constraint derivation in union/map types 2024-02-04 10:36:23 -05:00
Riccardo Binetti
6b09e7309e
improvement: make the items of fields and errors non-null (#112)
Last point left from the discussion on #105
2024-01-31 17:52:33 -05:00
Riccardo Binetti
8fff0d361d
improvement: make mutation arguments non-null (#111)
* 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
2024-01-31 17:52:01 -05:00
Riccardo Binetti
af4193feca
improvement: make mutation results non-nullable (#110)
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).
2024-01-31 15:59:07 -05:00
Riccardo Binetti
afa4ae66a0
improvement: return a map from decode_relay_id/1 (#107)
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.
2024-01-25 10:47:15 -05:00
Riccardo Binetti
365b3aedc6
feat: Relay refetching support (#106)
* 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.
2024-01-24 14:59:12 -05:00
Zach Daniel
7225d5fd28 test: test loading through w/ nil values 2024-01-21 12:06:48 -05:00
Zach Daniel
67fe4d64ec improvement: support latest ash 2024-01-19 00:13:39 -05:00
Zach Daniel
10d3d940cb chore: simplify docs generation 2024-01-12 14:53:43 -05:00
Zach Daniel
840230c110 chore: release version v0.26.9 2024-01-12 14:34:33 -05:00
Zach Daniel
067057b4db chore: update ex_doc 2024-01-12 14:34:15 -05:00
Zach Daniel
88aff4369d fix: properly transform not found errors 2023-12-05 16:44:21 -05:00
Zach Daniel
f83c447267 fix: respond with proper error on not found for get 2023-12-05 16:07:07 -05:00
Zach Daniel
51428483ef chore: raise error to help debugging 2023-12-05 15:32:47 -05:00
Zach Daniel
e16592f592 improvement: handle nil parent 2023-12-05 12:46:38 -05:00
Zach Daniel
896d5c8df3 chore: release version v0.26.8 2023-12-04 18:29:53 -05:00
Zach Daniel
c5163d4019 fix: fix dialyzer types for AshGraphql.Type 2023-12-04 18:29:30 -05:00
infinitis
4517a27f5f
fix: corrects spec for graphql_unnested_unions/1 (#103)
Co-authored-by: Alex Joss <alex.joss@coinbits.app>
2023-11-30 14:19:50 -05:00
Zach Daniel
e95c95282a fix: properly generate type for Ash.Type.DateTime 2023-11-28 17:32:31 -05:00
Barnabas Jovanovics
772e3851ce
test: add better regression test (#101) 2023-11-24 07:24:27 -05:00
Zach Daniel
a5583ff8dc chore: release version v0.26.7 2023-11-24 05:39:03 -05:00
Barnabas Jovanovics
b9a3051e88
fix: make sure generic actions are authorized (#100) 2023-11-24 05:29:01 -05:00
Zach Daniel
c1845b2225 chore: cheat sheets 2023-11-13 23:23:54 -05:00
Zach Daniel
cb87e6f4f6 chore: format/credo 2023-11-13 23:23:27 -05:00
Zach Daniel
e66a3ef4b8 fix: properly generate first aggregates with correct destination type 2023-11-13 23:02:57 -05:00
Zach Daniel
2cf5b60f63 improvement: support latest ash aggregate constraints 2023-11-13 16:53:21 -05:00
Zach Daniel
1401de6727 fix: pass context into loading and generate related query with it 2023-10-27 00:29:03 -04:00
Zach Daniel
a33e4f5b77 improvement: support define_relay_types?: false 2023-10-15 21:12:13 -04:00
Jake Demarest-Mays
0e4ac7130c
docs: Removed mention of Context and Dataloader in Getting Started with Graphql (#96) 2023-10-12 11:24:47 -04:00
Zach Daniel
65778a1e1f chore: release version v0.26.6 2023-10-06 13:52:54 -04:00
Barnabas Jovanovics
34fd313901
improvement: make the node in relay edges non-null (#95)
* make the node in relay edges non-null

* make the edge non-null too

* fix edge type
2023-10-03 13:48:27 -04:00
Zach Daniel
58a038e609 fix: generic action mutations need to use the input object 2023-10-02 19:44:19 -04:00
Zach Daniel
d7a49bc006 docs: add doc for use-subscriptions-with-graphql.md 2023-10-02 16:46:08 -04:00
Zach Daniel
d485f5378f chore: release version v0.26.5 2023-10-02 14:52:51 -04:00
Zach Daniel
cdb8cf7b7f fix: don't access .pagination on generic action 2023-10-02 14:47:31 -04:00
Zach Daniel
a67462c07f chore: only gather analytics on hexdocs.pm 2023-10-02 10:57:29 -04:00
Zach Daniel
b3ac663cfe chore: analytics in hexdocs 2023-10-02 08:35:53 -04:00
Zach Daniel
07296a5ef5 chore: release version v0.26.4 2023-10-01 09:53:27 -04:00
Tun Cham Roeun
4c86d31885
improvement: Add a top-level NOT filter, along with AND and OR filters. (#94) 2023-10-01 09:51:42 -04:00
Zach Daniel
46cd22db0d chore: release version v0.26.3 2023-09-28 17:31:54 -04:00
Zach Daniel
ca2e5342ac fix: fix primary key delimiter verificatoin step
docs: improve docs on unions
2023-09-28 17:31:27 -04:00
Zach Daniel
c6db0fce48 improvement: add AshGraphql.Type 2023-09-28 15:47:03 -04:00
Zach Daniel
b58503322b docs: update spark/ash for docs improvements 2023-09-26 23:21:57 -04:00
Zach Daniel
fc3423b45a improvement: optimize union type resolver compile time logic 2023-09-20 09:21:44 -04:00