Add graphiql options and missing flask context #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This add support for graphiql options like as:
default_query
: An optional GraphQL string to use when no query is provided and no stored query exists from a previous session. If not provided, GraphiQL will use its own default query.header_editor_enabled
: An optional boolean which enables the header editor when true. Defaults to false.should_persist_headers
: An optional boolean which enables to persist headers to storage when true. Defaults to false.Also, add the missing
context
attribute as requested at this old flask-graphql#52 issue.However, the approach I used for all 4 servers (flask, aiohttp, webob, sanic) was based on this sanic#8 issue which was solved at this pull request.
There are other related issues as well on each server integrations:
As far as I know, this
context
will be passed to theexecute
method on GraphQL, which will be passed to all resolve functions as stated on GraphQL-JS docs. At the end, this will be part of theGraphQLResolveInfo
, which is used by resolve_field_value_or_error to resolve the field.Based on that, I am not 100% sure if it the correct way of handling custom context for all server integrations so any suggestion is welcome!