A way to change middleware of `_entities` field
rewritten opened this issue · 4 comments
As of now, the middleware for the generated _entities
field is hardcoded to be the Absinthe.Federation.Schema.EntitiesField
module (https://github.com/DivvyPayHQ/absinthe_federation/blob/v0.3.2/lib/absinthe/federation/schema/entities_field.ex#L80).
Is there a way to plug another middleware there in its place?
You could modify the schema pipeline and remove absinthe_federation pipeline phases and replace them with your own. Not sure if our pipelines give the right granularity to just remove that one field but we could change that to make it easier
Interesting, I will give it a shot. It might be interesting to have a way to opt out of the federation phases. Or maybe that is just a matter of not using this package, and explicitly declare the _Entity
interface and the _entities
root field...
Feel free to close if the opt-out feature is not interesting for you.
You could also try to change the middleware using the hydrate/2 callback. It's not documented well, but there are examples in the tests of Absinthe.
Or, I could prepend a middleware that makes sure to take control of that specific field. I'll try this out.