graphql-server
graphql-server copied to clipboard
Add execution_context_class argument in Flask GraphQLView
Proposed PR for issue posted in https://github.com/graphql-python/graphql-server/issues/76
Did a quick test and this works in my local environment
if this looks like something that makes sense, I can work on necessary changes to merge (tests and such)
Possible other changes
- add this to the other server integrations?
- maybe add some of the other arguments in
execute(), or make a more generic way to be able to pass arbitrary **kwargs
Usage example
from graphene.types.schema import UnforgivingExecutionContext
view = GraphQLView.as_view(
...
execution_context_class=UnforgivingExecutionContext,
)
Changes looks great as it isn't a big issue with arbitrary kwargs being passed to run_http_query.
Under the hood, these graphql-server methods make use of graphql-core execute() function which supports specific arguments like as execution_context_class but are hidden inside graphql-server run_http_query method as **execute_options.
This change should be easy to implement on the other integrations as well but would like some test suite for this new feature.
Sounds good will look into adding tests
Any way to help get this change across the finish line? This seems pretty critical to error handling.
Yeah sorry haven't had a chance to work on adding the tests. I'll see if I can find some time soon; if you'd like to help with that feel free to submit a commit and I can merge it here
Superseded by #100