-
-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added excution_context_class for custom ExecutionContext #6
Conversation
238f0a1
to
e49f851
Compare
Sorry it took so long for me to review, life got in the way. I like this way of integration that allows keeping the code close to GraphQL.js. Thoughts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments above.
Replying inline:
I was thinking something similar, but discarded since at the end the result of the build function should be
Will do for next time! ;)
I'm using black for uniform code formatting. It get's executed each time I save a file using VSCode. Thoughts? |
Ok, let's use your original proposal then.
I haven't used black so far. Just had a look and I'm not so excited about the 88 char limit and using double quotes by default which both go against common Python conventions - PEP 8 recommends 79 chars and repr() outputs single quotes. OTOH, not having to care about formatting and consistency throughout the GraphQL projects is more important. I think I'll make the switch and convert everything to black conventions then. |
This PR is essential for having the package usable within Graphene.
Graphene needs a custom
get_variable_values
,get_argument_values
, since the input arguments provided in the GraphQL query will becamelCase
but it should be received withsnake_case
by the resolver.In
graphql-core
we useout_name
in the main implementation.https://github.com/graphql-python/graphql-core/blob/master/graphql/execution/values.py#L110
There are some other non-performant ways to achieve this (such as decorating the resolver to snake case the args automatically), but I'm intentionally trying to avoid them since it causes a lot of performance/memory headaches.
Since we want to keep
graphql-core-next
closer to the javascript implementation, I think is much easier to move this logic intographene
itself, hence the need of customizingExecutionContext
.