graphql-python / graphql-server

This is the core package for using GraphQL in a custom server easily
MIT License
120 stars 72 forks source link

Add execution_context_class argument in Flask GraphQLView #77

Closed alvinchow86 closed 1 year ago

alvinchow86 commented 3 years ago

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

Usage example

from graphene.types.schema import UnforgivingExecutionContext

view = GraphQLView.as_view(
       ...
        execution_context_class=UnforgivingExecutionContext,
    )
KingDarBoja commented 3 years ago

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.

alvinchow86 commented 3 years ago

Sounds good will look into adding tests

jzelinskie commented 2 years ago

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

alvinchow86 commented 2 years ago

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

kiendang commented 1 year ago

Superseded by #100