mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-13 13:16:49 +03:00
Removed map_type until the last version of graphql-core is on PyPI
This commit is contained in:
parent
4e8fd488ff
commit
b511563ccc
|
@ -51,7 +51,9 @@ class Schema(object):
|
||||||
@property
|
@property
|
||||||
def executor(self):
|
def executor(self):
|
||||||
if not self._executor:
|
if not self._executor:
|
||||||
self.executor = Executor([SynchronousExecutionMiddleware()], map_type=OrderedDict)
|
# TODO: Update to map_type=OrderedDict when graphql-core
|
||||||
|
# update its package in pypi
|
||||||
|
self.executor = Executor([SynchronousExecutionMiddleware()])
|
||||||
return self._executor
|
return self._executor
|
||||||
|
|
||||||
@executor.setter
|
@executor.setter
|
||||||
|
@ -72,8 +74,6 @@ class Schema(object):
|
||||||
return object_type
|
return object_type
|
||||||
|
|
||||||
def get_type(self, type_name):
|
def get_type(self, type_name):
|
||||||
# print 'get_type'
|
|
||||||
# _type = self.schema.get_type(type_name)
|
|
||||||
if type_name not in self._internal_types:
|
if type_name not in self._internal_types:
|
||||||
raise Exception('Type %s not found in %r' % (type_name, self))
|
raise Exception('Type %s not found in %r' % (type_name, self))
|
||||||
return self._internal_types[type_name]
|
return self._internal_types[type_name]
|
||||||
|
@ -84,23 +84,30 @@ class Schema(object):
|
||||||
|
|
||||||
def execute(self, request='', root=None, vars=None, operation_name=None):
|
def execute(self, request='', root=None, vars=None, operation_name=None):
|
||||||
root = root or object()
|
root = root or object()
|
||||||
source = Source(request, 'GraphQL request')
|
return graphql(
|
||||||
ast = parse(source)
|
|
||||||
validation_errors = validate(self.schema, ast)
|
|
||||||
if validation_errors:
|
|
||||||
return ExecutionResult(
|
|
||||||
errors=validation_errors,
|
|
||||||
invalid=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
return self.executor.execute(
|
|
||||||
self.schema,
|
self.schema,
|
||||||
ast,
|
request,
|
||||||
root=self.query(root),
|
root=self.query(root),
|
||||||
args=vars,
|
vars=vars,
|
||||||
operation_name=operation_name,
|
operation_name=operation_name
|
||||||
validate_ast=False
|
|
||||||
)
|
)
|
||||||
|
# source = Source(request, 'GraphQL request')
|
||||||
|
# ast = parse(source)
|
||||||
|
# validation_errors = validate(self.schema, ast)
|
||||||
|
# if validation_errors:
|
||||||
|
# return ExecutionResult(
|
||||||
|
# errors=validation_errors,
|
||||||
|
# invalid=True,
|
||||||
|
# )
|
||||||
|
|
||||||
|
# return self.executor.execute(
|
||||||
|
# self.schema,
|
||||||
|
# ast,
|
||||||
|
# root=self.query(root),
|
||||||
|
# args=vars,
|
||||||
|
# operation_name=operation_name,
|
||||||
|
# validate_ast=False
|
||||||
|
# )
|
||||||
|
|
||||||
def introspect(self):
|
def introspect(self):
|
||||||
return self.execute(introspection_query).data
|
return self.execute(introspection_query).data
|
||||||
|
|
Loading…
Reference in New Issue
Block a user