File tree Expand file tree Collapse file tree 1 file changed +18
-14
lines changed Expand file tree Collapse file tree 1 file changed +18
-14
lines changed Original file line number Diff line number Diff line change 12
12
GraphQLSchema ,
13
13
GraphQLString ,
14
14
)
15
+ from graphql .utilities import build_schema
15
16
16
17
sync_error = RuntimeError ("sync" )
17
18
sync_non_null_error = RuntimeError ("syncNonNull" )
@@ -73,22 +74,25 @@ async def promiseNonNullNest(self, _info):
73
74
return NullingData ()
74
75
75
76
76
- DataType = GraphQLObjectType (
77
- "DataType" ,
78
- lambda : {
79
- "sync" : GraphQLField (GraphQLString ),
80
- "syncNonNull" : GraphQLField (GraphQLNonNull (GraphQLString )),
81
- "promise" : GraphQLField (GraphQLString ),
82
- "promiseNonNull" : GraphQLField (GraphQLNonNull (GraphQLString )),
83
- "syncNest" : GraphQLField (DataType ),
84
- "syncNonNullNest" : GraphQLField (GraphQLNonNull (DataType )),
85
- "promiseNest" : GraphQLField (DataType ),
86
- "promiseNonNullNest" : GraphQLField (GraphQLNonNull (DataType )),
87
- },
77
+ schema = build_schema (
78
+ """
79
+ type DataType {
80
+ sync: String
81
+ syncNonNull: String!
82
+ promise: String
83
+ promiseNonNull: String!
84
+ syncNest: DataType
85
+ syncNonNullNest: DataType!
86
+ promiseNest: DataType
87
+ promiseNonNullNest: DataType!
88
+ }
89
+
90
+ schema {
91
+ query: DataType
92
+ }
93
+ """
88
94
)
89
95
90
- schema = GraphQLSchema (DataType )
91
-
92
96
93
97
def execute_query (query , root_value ):
94
98
return execute (schema , parse (query ), root_value )
You can’t perform that action at this time.
0 commit comments