graphql-python / graphql-core

A Python 3.6+ port of the GraphQL.js reference implementation of GraphQL.
MIT License
512 stars 136 forks source link

How to pass additional information to GraphQLResolveInfo #226

Open patrick91 opened 2 months ago

patrick91 commented 2 months ago

Hi there 😊

I was looking at this PR on Strawberry: https://github.com/strawberry-graphql/strawberry/pull/3461

and I was wondering if there's a nicer to pass the input extensions data around, so I stumbled on the ExecutionContext class which can be useful for us to customise the GraphQLResolveInfo data[1], but I haven't figured out a nice way to pass some data to ExecutionContext.build without customising the execute function here: https://github.com/graphql-python/graphql-core/blob/9dcf25e66f6ed36b77de788621cf50bab600d1d3/src/graphql/execution/execute.py#L1844-L1856

Is there a better alternative for something like this?

[1] We also have a custom version of info, so customising the ExecutionContext class will help with that too :D