Description
In Absinthe, stacktraces and resolution structs usually are pretty big due in part to the %Absinthe.Document.Operation{}
showing the entire AST of the GraphQL document. Scanning this is pretty hard.
Currently, when inspecting the Absinthe schema with a similar AST using IO.inspect
it will be rendered as SDL. I propose to also apply this method to the %Absinthe.Document.Operation{}
struct.
I have a PoC working, which like the SDL uses the Inspect.Algebra to format the document AST as GraphQL. Currently it renders the document like this:
#...
variable_definitions: []}], loc: nil}, name: nil, operations: [#Absinthe.Document.Operation<variables: %{}, document: "query hello {
nameFromContext
a:nameFromContext
}">
], prototype_schema: nil, result: %{data: nil}, schema: #...
So, the rendering includes the name of the struct and some extra data. Optionally a parameter could be supplied to Inspect.Opts (see custom_options
) to just render the GraphQL document.
If there's interest in getting this into Absinthe I'll file a PR.