mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-11-04 18:07:48 +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 collections import OrderedDict
 | 
			
		||||
 | 
			
		||||
from graphql.core import graphql
 | 
			
		||||
from graphql.core.type import (
 | 
			
		||||
    GraphQLSchema as _GraphQLSchema
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
from graphql.core.execution.executor import Executor
 | 
			
		||||
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 graphene import signals
 | 
			
		||||
| 
						 | 
				
			
			@ -51,9 +46,7 @@ class Schema(object):
 | 
			
		|||
    @property
 | 
			
		||||
    def executor(self):
 | 
			
		||||
        if not self._executor:
 | 
			
		||||
            # TODO: Update to map_type=OrderedDict when graphql-core
 | 
			
		||||
            # update its package in pypi
 | 
			
		||||
            self.executor = Executor([SynchronousExecutionMiddleware()])
 | 
			
		||||
            self.executor = Executor([SynchronousExecutionMiddleware()], map_type=OrderedDict)
 | 
			
		||||
        return self._executor
 | 
			
		||||
 | 
			
		||||
    @executor.setter
 | 
			
		||||
| 
						 | 
				
			
			@ -84,30 +77,13 @@ class Schema(object):
 | 
			
		|||
 | 
			
		||||
    def execute(self, request='', root=None, vars=None, operation_name=None):
 | 
			
		||||
        root = root or object()
 | 
			
		||||
        return graphql(
 | 
			
		||||
        return self.executor.execute(
 | 
			
		||||
            self.schema,
 | 
			
		||||
            request,
 | 
			
		||||
            root=self.query(root),
 | 
			
		||||
            vars=vars,
 | 
			
		||||
            operation_name=operation_name
 | 
			
		||||
            args=vars,
 | 
			
		||||
            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):
 | 
			
		||||
        return self.execute(introspection_query).data
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								setup.py
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -24,7 +24,7 @@ class PyTest(TestCommand):
 | 
			
		|||
 | 
			
		||||
setup(
 | 
			
		||||
    name='graphene',
 | 
			
		||||
    version='0.1.4',
 | 
			
		||||
    version='0.1.5',
 | 
			
		||||
 | 
			
		||||
    description='Graphene: Python DSL for GraphQL',
 | 
			
		||||
    long_description=open('README.rst').read(),
 | 
			
		||||
| 
						 | 
				
			
			@ -56,7 +56,7 @@ setup(
 | 
			
		|||
    install_requires=[
 | 
			
		||||
        'six>=1.10.0',
 | 
			
		||||
        'blinker',
 | 
			
		||||
        'graphql-core==0.1a2',
 | 
			
		||||
        'graphql-core==0.1a3',
 | 
			
		||||
        'graphql-relay==0.2.0'
 | 
			
		||||
    ],
 | 
			
		||||
    tests_require=[
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user