Let GraphQLApp take extra arguments for schema.execute()


I’d like to suggest that the GraphQLApp() can accept optional extra arguments that are later passed on to the execute() method on the Graphene schema.

My use case is that I want to use Graphene middleware, which is passed to schema.execute. I’d like to do something like this:

app = Starlette()
gql = starlette.graphql.GraphQLApp(
    execute_options={'middleware': [my_graphene_middleware_func]}
app.add_route("/graphql", gql)

The execute_options dict could then be passed on by starlette.graphql.GraphQLApp.execute to the execute method of Schema.

Let me know if you think it’s a good idea or if there maybe are some other solution to the problem. For now, I’m monkeypatching schema.execute method to be able to modify it’s arguments - a hack, essentially.