graphql-server icon indicating copy to clipboard operation
graphql-server copied to clipboard

Add execution_context_class argument in Flask GraphQLView

Open alvinchow86 opened this issue 4 years ago • 4 comments

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,
    )

alvinchow86 avatar Dec 11 '20 23:12 alvinchow86

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.

KingDarBoja avatar Dec 12 '20 15:12 KingDarBoja

Sounds good will look into adding tests

alvinchow86 avatar Dec 15 '20 09:12 alvinchow86

Any way to help get this change across the finish line? This seems pretty critical to error handling.

jzelinskie avatar May 02 '22 22:05 jzelinskie

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

alvinchow86 avatar May 02 '22 23:05 alvinchow86

Superseded by #100

kiendang avatar Apr 06 '23 15:04 kiendang