Skip to content

Commit a649405

Browse files
committed
Implement type validation #8
1 parent c7c2698 commit a649405

File tree

13 files changed

+358
-145
lines changed

13 files changed

+358
-145
lines changed

graphql/core/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from .validation import validate
55

66

7-
def graphql(schema, request='', root=None, vars=None, operation_name=None):
7+
def graphql(schema, request='', root=None, args=None, operation_name=None):
88
try:
99
source = Source(request, 'GraphQL request')
1010
ast = parse(source)
@@ -19,7 +19,7 @@ def graphql(schema, request='', root=None, vars=None, operation_name=None):
1919
root or object(),
2020
ast,
2121
operation_name,
22-
vars or {},
22+
args or {},
2323
)
2424
except Exception as e:
2525
return ExecutionResult(

graphql/core/execution/executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def complete_value(self, ctx, return_type, field_asts, info, result):
291291
if not runtime_type:
292292
return None
293293

294-
if not runtime_type.is_type_of(result, info):
294+
if runtime_type.is_type_of and not runtime_type.is_type_of(result, info):
295295
raise GraphQLError(
296296
u'Expected value of type "{}" but got {}.'.format(return_type, type(result).__name__),
297297
field_asts

0 commit comments

Comments
 (0)