mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-04-13 05:34:20 +03:00
Add missing schema validation step
This commit is contained in:
parent
056cd4105e
commit
d2013cc7f0
|
@ -9,7 +9,14 @@ from django.shortcuts import render
|
|||
from django.utils.decorators import method_decorator
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.generic import View
|
||||
from graphql import ExecutionResult, OperationType, execute, get_operation_ast, parse
|
||||
from graphql import (
|
||||
ExecutionResult,
|
||||
OperationType,
|
||||
execute,
|
||||
get_operation_ast,
|
||||
parse,
|
||||
validate_schema,
|
||||
)
|
||||
from graphql.error import GraphQLError
|
||||
from graphql.execution.middleware import MiddlewareManager
|
||||
from graphql.language import OperationDefinitionNode
|
||||
|
@ -296,6 +303,10 @@ class GraphQLView(View):
|
|||
return None
|
||||
raise HttpError(HttpResponseBadRequest("Must provide query string."))
|
||||
|
||||
schema_validation_errors = validate_schema(self.schema.graphql_schema)
|
||||
if schema_validation_errors:
|
||||
return ExecutionResult(data=None, errors=schema_validation_errors)
|
||||
|
||||
try:
|
||||
document = parse(query)
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in New Issue
Block a user