Skip to content

Instantly share code, notes, and snippets.

@ktosiek
Created January 24, 2019 18:45
Show Gist options
  • Save ktosiek/a309f772399482a47cf2c4ed219ff1af to your computer and use it in GitHub Desktop.
Save ktosiek/a309f772399482a47cf2c4ed219ff1af to your computer and use it in GitHub Desktop.
Return raw values from python graphql-core, skipping the complete_*_value functions.
import graphql.execution.executor
def complete_value(exe_context, return_type, field_asts, info, path, result):
if isinstance(result, RawGraphQLResult):
return result.value
return _complete_value(exe_context, return_type, field_asts, info, path, result)
class RawGraphQLResult:
def __init__(self, value):
self.value = value
_complete_value = graphql.execution.executor.complete_value
graphql.execution.executor.complete_value = complete_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment