Commit graph

75 commits

Author SHA1 Message Date
Zach Daniel
84b86e65be improvement: add graphql_define_type?/1 callback for graphql types 2024-04-24 09:21:26 -04:00
Zach Daniel
1331bdd4ce improvement: support generic actions with no return type 2024-04-11 13:11:37 -04:00
Zach Daniel
349086fbb8 improvement!: No longer automagically derive types 2024-04-01 15:27:43 -04:00
Riccardo Binetti
513c1ac68f
improvement!: port AshGraphql to Ash 3.0 (#123)
Step 1: update Ash

Step 2: mass rename Api to Domain

Step 3: Ash.Query.expr -> Ash.Expr.expr

Also change ref interpolation

Step 4: remove all warnings

Step 5: remove registries from tests

Step 6: fix filter

Step 7: private? -> !public?

Step 8: Ash.Calculation -> Ash.Resource.Calculation

Step 9: use depend_on_resources/1 -> resources/1

Step 10: add Domain to all resources

Step 11: use Ash module for all actions

Step 12: add public? true all around

Step 13: remove verbose? from options passed during Domain calls

Step 14: add simple_sat

Step 15: Ash.ErrorKind is no more, so remove code from errors

Step 16: sprinkle default_accept :* around tests

Step 17: replace Ash.Changeset.new/2 with Ash.Changeset.for_*

Step 18: calculation fixups

- Context is now a struct and arguments go under the arguments key
- Function based calculations receive a list of records
- Add a select to query-based loads
- select -> load

Step 19: pass the correct name to pass the policy in tests

Step 20: Ash.Query.new/2 is no more

Step 21: add AshGraphql.Resource.embedded? utility function

Use that instead of Ash.Type.embedded_type?(resource_or_type) since resources
are not types anymore

Step 22: handle struct + instance_of: Resource in unions

Resources are not type anymore so they need to be passed this way in unions

Step 23: ensure we only check GraphQL actions for pagination

All reads are now paginated by default, so this triggered a compilation error

Step 24: swap arguments for sort on calculations

Step 25: remove unused debug? option
2024-04-01 14:03:06 -04:00
Riccardo Binetti
98baf6f0be
feat: allow providing descriptions for enum values (#117)
* 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
2024-03-25 23:43:59 -04:00
Zach Daniel
51004afa8d fix: include generic actions in enum filtering 2024-03-14 23:09:44 -04: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
a33e4f5b77 improvement: support define_relay_types?: false 2023-10-15 21:12:13 -04:00
Zach Daniel
fc3423b45a improvement: optimize union type resolver compile time logic 2023-09-20 09:21:44 -04:00
Zach Daniel
d5e8781abf fix: recurse through array types for union checking 2023-07-31 22:14:11 -04:00
Jeremy Grant
682a240aa9
fix: {:array, UnionType} issues resolving embedded types (#82) 2023-07-03 23:42:40 -04:00
Zach Daniel
61003d539a chore: update fix with exception for embedded resources 2023-06-28 10:52:23 -04:00
Zach Daniel
eb6d4f24f7 fix: only include types for actions being used by ash_graphql 2023-06-28 10:20:59 -04:00
Zach Daniel
045426c629 fix: account for lists of newtype unions 2023-06-14 10:21:20 -04:00
Zach Daniel
05be948204 improvement: revamp data loading to be a single load statement 2023-06-09 00:45:39 -04:00
Zach Daniel
000809b34f improvement: graphql_rename_value/1 for enums
docs: union guide & improved enum guide
2023-05-23 17:11:58 -04:00
Zach Daniel
db23b32552 fix: various problems with resolving unions in relationship changes 2023-05-17 22:41:24 -04:00
Barnabas Jovanovics
48392115e0
feat: create types for maps with constraints (#68) 2023-05-15 09:39:32 -04:00
Zach Daniel
79a7145c44 improvement: support hiding fields 2023-04-26 23:40:41 -04:00
Zach Daniel
e91001e83f improvement: better union type handling
still need to document this, but adding support for
`graphql_unnested_unions/1` on `NewType` defined unions.

This allows for lifting up union type values to not be nested under `value`
2023-04-21 01:12:20 -06:00
Zach Daniel
3cc3c32f45 improvement: add support for Ash.Type.NewType 2023-03-13 18:32:36 -04:00
Zach Daniel
443e5fd680 improvement: add action_middleware option 2023-02-22 12:19:50 -05:00
Zach Daniel
4c26944f73 fix: don't traverse nested types for auto enums 2023-02-21 08:51:35 -05:00
Zach Daniel
e15b90e009 fix: properly traverse all embedded/enum types 2023-02-15 15:10:22 -05:00
Zach Daniel
ef5559ed51 fix: infinite recursion in filterability checking 2023-02-15 13:37:55 -05:00
Zach Daniel
cf8267123e improvement: support new union types in ash 2023-02-15 08:20:35 -05:00
Zach Daniel
fbebb21d18 fix: ensure types are compiled when checking for enum 2023-02-09 01:23:41 -05:00
Zach Daniel
79b12ddcec fix: properly fetch all global enum types 2023-02-09 01:00:36 -05:00
Zach Daniel
3c7c14c065 docs: add AshGraphql to docs 2023-02-08 22:59:20 -05:00
Zach Daniel
48e6271d0d fix: don't set mutation block if no mutations exist 2022-11-01 21:58:41 -04:00
Zach Daniel
c650126819 fix: resolve issues compiling resources with no type
fix: adding an empty query block is apparently problematic?
2022-10-31 13:07:57 -04:00
Zach Daniel
9ff395711e improvement: handle keyset & offset pagination when combined on an action (by preferring keyset)
improvement: use new `depend_on_resources/` from Ash to remove the need for registry in schema
fix: various pagination fixes
2022-10-21 08:51:31 -04:00
Zach Daniel
c5662e90ba improvement: validate that relay? queries use keyset?: true actions
improvement: only add `count` to pages when one relevant query is countable
2022-10-21 07:38:33 -04:00
Zach Daniel
b1bdc49ec5 fix: reference schema not generated module when adding types 2022-10-20 15:03:13 -04:00
Zach Daniel
195ec3cd4f fix: handle empty root query/root mutation blocks
closes: #10
2022-10-12 17:25:33 -04:00
Maxim Martynov
e40e7c573c
improvement: Implement GraphQL Relay support (#36) 2022-09-20 23:07:30 -04:00
Zach Daniel
f4cb9213b3 update to latest ash 2022-08-30 19:08:16 -06:00
Zach Daniel
0a241cb26e fix: update to latest ash and use new interval type 2022-05-23 16:33:27 -04:00
Maxim Martynov
cc5f3a31f2
fix: Handle error if multitenant resource was fetched without tenant being set (#33) 2022-05-11 12:45:49 -04:00
Zach Daniel
d00e0a6e5d improvement: require registry explicitly to help with compile times 2022-05-10 11:49:19 -04:00
Zach Daniel
5e2b1bc16f fix: depend on registry at compile time 2022-04-26 12:46:51 -04:00
Zach Daniel
8ed9938201 improvement: fix lint/credo/versions 2022-04-26 11:35:09 -04:00
Zach Daniel
a8aa57e0f5 fix: add relay node type properly 2022-04-04 16:55:22 -04:00
Zach Daniel
5d35cf092e fix: ignore embedded resources accidentally placed in API 2022-03-25 13:17:35 -04:00
Zach Daniel
fdee19c3a5 fix: don't include the same enum multiple times 2022-03-24 17:05:53 -04:00
Zach Daniel
191b9b2d80 fix: properly generate types for interval type 2022-01-31 15:06:06 -05:00
Zach Daniel
862bfdd7b4 improvement: updates to handle the new registry changes 2022-01-31 14:55:14 -05:00
Zach Daniel
d2d8f199f7 fix: search for types in calculations 2021-09-07 17:06:20 -04:00
Zach Daniel
b313618d3a fix: include new custom type 2021-06-21 17:20:24 -04:00
Zach Daniel
23094215ef fix: avoid dialyzer errors on generated code 2021-05-19 01:29:57 -04:00