Closed ekobi closed 4 years ago
Reproducing recommended workaround for the record:
The easiest work around is to just set a value manually, by introducing a custom phase:
pipeline =
My.Api.Schema
|> Absinthe.Pipeline.for_document(options)
|> Absinthe.Pipeline.without(Absinthe.Phase.Subscription.SubscribeSelf)
|> Absinthe.Pipeline.without(Absinthe.Phase.Document.Execution.Resolution)
|> Absinthe.Pipeline.insert_before(Absinthe.Phase.Document.Result, MyApp.AbsintheFakeResult)
defmodule MyApp.AbsintheFakeResult do
def run(blueprint, _) do
blueprint = put_in(blueprint.execution.result, %{value: nil})
{:ok, blueprint}
end
end
Right, I think fundamentally the Result phase should just be made to work properly on documents with no execution result, which I think would be pretty easy.
This is an issue I reported on the Elixir forum, for which @benwilson512 provided a workaround. Wondering if either
Absinthe.Pipeline.run()
could handle applying the workaround automatically;or, alternatively
Absinthe.Pipeline
could provide afor_document_validation()
function that builds a suitably patched input forrun()
If submitting a bug, please provide the following:
Environment
Expected behavior
Absinthe.Pipeline.run()
expected to validate provided executable GQL document and parameters against schema.Actual behavior
Does the right thing given invalid data/parameters, but barfs on well-formed documents thus: