1
1
2
- from graphql import GraphQLSchema , MiddlewareManager , graphql , is_type
2
+ from graphql import GraphQLSchema , graphql , is_type
3
3
from graphql .type .directives import (GraphQLDirective , GraphQLIncludeDirective ,
4
4
GraphQLSkipDirective )
5
5
from graphql .type .introspection import IntrospectionSchema
@@ -14,18 +14,15 @@ class Schema(GraphQLSchema):
14
14
Schema Definition
15
15
16
16
A Schema is created by supplying the root types of each type of operation,
17
- query and mutation (optional). A schema definition is then supplied to the
18
- validator and executor.
17
+ query and mutation (optional).
19
18
'''
20
19
21
20
def __init__ (self , query = None , mutation = None , subscription = None ,
22
- directives = None , types = None , executor = None , middlewares = None ,
23
- auto_camelcase = True ):
21
+ directives = None , types = None , auto_camelcase = True ):
24
22
self ._query = query
25
23
self ._mutation = mutation
26
24
self ._subscription = subscription
27
25
self .types = types
28
- self ._executor = executor
29
26
self .auto_camelcase = auto_camelcase
30
27
if directives is None :
31
28
directives = [
@@ -37,10 +34,6 @@ def __init__(self, query=None, mutation=None, subscription=None,
37
34
'Schema directives must be List[GraphQLDirective] if provided but got: {}.' .format (
38
35
directives
39
36
)
40
- if middlewares :
41
- self .middlewares = MiddlewareManager (* middlewares )
42
- else :
43
- self .middlewares = None
44
37
self ._directives = directives
45
38
self .build_typemap ()
46
39
@@ -65,18 +58,8 @@ def get_graphql_type(self, _type):
65
58
return graphql_type
66
59
raise Exception ("{} is not a valid GraphQL type." .format (_type ))
67
60
68
- def execute (self , request_string = '' , root_value = None , variable_values = None ,
69
- context_value = None , operation_name = None , executor = None ):
70
- return graphql (
71
- schema = self ,
72
- request_string = request_string ,
73
- root_value = root_value ,
74
- context_value = context_value ,
75
- variable_values = variable_values ,
76
- operation_name = operation_name ,
77
- executor = executor or self ._executor ,
78
- middlewares = self .middlewares
79
- )
61
+ def execute (self , * args , ** kwargs ):
62
+ return graphql (self , * args , ** kwargs )
80
63
81
64
def register (self , object_type ):
82
65
self .types .append (object_type )
0 commit comments