-
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
how to point __resolveReference method to _resolveReference? #65
Comments
The gateway should never be calling that resolver directly but should use the |
We are using |
If you follow the "Defining an entity" link in that Apollo Server documentation, it says There is an example repository with multiple entity examples and tests in Elixir if it would be helpful. |
When i tried following the above approach, it throw me with below error
There was a similar issue faced by another person, and he mentioned the below approach i had to change the resolver enclosed inside anonymnous function call.
but the resulting output is %{data: %{"_entities" => [%{}]}} |
where is the field definition of that If you define it under the correct object definition like this query do
end
object :book do
extends()
key_fields("id")
field :id, :id do
external()
end
field :name, :string
field :_resolve_reference, :book do
resolve(fn _, args, _ -> Books.get_book(nil, args, nil) end)
end
end then run a query like this: query GetBookEntities($representations: [_Any]) {
_entities(representations: $representations) {
... on Book {
name
id
__typename
}
}
} with variables: it would resolve the entity's fields |
We added a test to demonsrate how |
I had the same issue and solved it by using an anonymous function (as per @abhilashr2021's comment - thanks!) Why doesn't it work with function capturing? resolve(&Books.get_books/3) |
@tristantreb its likely due to the complexities of the compile-time magic that absinthe is doing and how it captures those references using macros. I do think its solvable and we should see if we can get a fix for it |
This will be fixed by #104 |
Hi,
So as per this doc https://www.apollographql.com/docs/apollo-server/using-federation/api/apollo-subgraph/#__resolvereference the
__resolveReference
has to be called ( and it cannot be changed ) and not_resolveReference
so I am not able to make it work, is there a config need to be changed?The text was updated successfully, but these errors were encountered: