-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework how entities_field works #104
base: main
Are you sure you want to change the base?
Rework how entities_field works #104
Conversation
e42dfd1
to
3aa1cb9
Compare
- Support Async resolution with 0-arity function - Support Dataloader.Ecto - Support function capture resolution
3aa1cb9
to
893e93b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maciej-szlosarczyk thank you so much for working on this! These are some great changes, and I left a few comments. If you can address those, I'll be happy to run another test suite on my end.
@kzlsakal Thanks for taking a look, I added the functionality and required test. Should be all good now, let me know if you need to rebase all changes into a single commit and I'll do just that. |
def call(%{arguments: %{item_id: item_id, __typename: "ItemWithModuleMiddleware"}} = res, _opts) do | ||
value = %{item_id: "ModuleMiddleware:#{item_id}", __typename: "ItemWithModuleMiddleware"} | ||
Map.put(res, :value, value) | ||
end | ||
|
||
def call(res, _opts) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absinthe.Middleware.call/2
has the following function spec:
call(Absinthe.Resolution.t(), term) :: Absinthe.Resolution.t()
We may want to have only one call/2
definition in this test middleware and ensure we're not calling it with something other than an Absinthe.Resolution
struct as the first argument, otherwise it could be a breaking change for many codebases that expect what Absinthe specifies for it. What do you think?
|
||
# setup do | ||
# end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# setup do | |
# end |
Hey 👋 Great work on library!
This is a pretty big PR to address the following points:
The main idea here is to use normal middleware pipeline for each resolved representation instead of looking at what those middlewares actually are. Unfortunately it changes some API examples and tests, but it brings them in-line with how Absinthe works in general. I.e async/2 helper requires the first argument to be a 0-arity function, but for some reason the tests used 1-arity.