mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-02 12:44:15 +03:00
Updated to work with the last version of graphql-core supporting field ordering
This commit is contained in:
parent
bad3dd4a4e
commit
2b6a253b78
|
@ -1,17 +1,12 @@
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from graphql.core import graphql
|
|
||||||
from graphql.core.type import (
|
from graphql.core.type import (
|
||||||
GraphQLSchema as _GraphQLSchema
|
GraphQLSchema as _GraphQLSchema
|
||||||
)
|
)
|
||||||
|
|
||||||
from graphql.core.execution.executor import Executor
|
from graphql.core.execution.executor import Executor
|
||||||
from graphql.core.execution.middlewares.sync import SynchronousExecutionMiddleware
|
from graphql.core.execution.middlewares.sync import SynchronousExecutionMiddleware
|
||||||
from graphql.core.execution import ExecutionResult, execute
|
|
||||||
from graphql.core.language.parser import parse
|
|
||||||
from graphql.core.language.source import Source
|
|
||||||
from graphql.core.validation import validate
|
|
||||||
|
|
||||||
from graphql.core.utils.introspection_query import introspection_query
|
from graphql.core.utils.introspection_query import introspection_query
|
||||||
from graphene import signals
|
from graphene import signals
|
||||||
|
@ -51,9 +46,7 @@ class Schema(object):
|
||||||
@property
|
@property
|
||||||
def executor(self):
|
def executor(self):
|
||||||
if not self._executor:
|
if not self._executor:
|
||||||
# TODO: Update to map_type=OrderedDict when graphql-core
|
self.executor = Executor([SynchronousExecutionMiddleware()], map_type=OrderedDict)
|
||||||
# update its package in pypi
|
|
||||||
self.executor = Executor([SynchronousExecutionMiddleware()])
|
|
||||||
return self._executor
|
return self._executor
|
||||||
|
|
||||||
@executor.setter
|
@executor.setter
|
||||||
|
@ -84,30 +77,13 @@ 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()
|
||||||
return graphql(
|
return self.executor.execute(
|
||||||
self.schema,
|
self.schema,
|
||||||
request,
|
request,
|
||||||
root=self.query(root),
|
root=self.query(root),
|
||||||
vars=vars,
|
args=vars,
|
||||||
operation_name=operation_name
|
operation_name=operation_name,
|
||||||
)
|
)
|
||||||
# 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
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -24,7 +24,7 @@ class PyTest(TestCommand):
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='graphene',
|
name='graphene',
|
||||||
version='0.1.4',
|
version='0.1.5',
|
||||||
|
|
||||||
description='Graphene: Python DSL for GraphQL',
|
description='Graphene: Python DSL for GraphQL',
|
||||||
long_description=open('README.rst').read(),
|
long_description=open('README.rst').read(),
|
||||||
|
@ -56,7 +56,7 @@ setup(
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'six>=1.10.0',
|
'six>=1.10.0',
|
||||||
'blinker',
|
'blinker',
|
||||||
'graphql-core==0.1a2',
|
'graphql-core==0.1a3',
|
||||||
'graphql-relay==0.2.0'
|
'graphql-relay==0.2.0'
|
||||||
],
|
],
|
||||||
tests_require=[
|
tests_require=[
|
||||||
|
|
Loading…
Reference in New Issue
Block a user