mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-04-12 13:14:23 +03:00
Enable customizing validate max_errors through settings
This commit is contained in:
parent
f88900017d
commit
918b590eea
|
@ -269,3 +269,14 @@ Default: ``False``
|
|||
|
||||
|
||||
.. _GraphiQLDocs: https://graphiql-test.netlify.app/typedoc/modules/graphiql_react#graphiqlprovider-2
|
||||
|
||||
|
||||
``MAX_VALIDATION_ERRORS``
|
||||
------------------------------------
|
||||
|
||||
In case ``validation_rules`` are provided to ``GraphQLView``, if this is set to a non-negative ``int`` value,
|
||||
``graphql.validation.validate`` will stop validation after this number of errors has been reached.
|
||||
If not set or set to ``None``, the maximum number of errors will follow ``graphql.validation.validate`` default
|
||||
*i.e.* 100.
|
||||
|
||||
Default: ``None``
|
||||
|
|
|
@ -43,6 +43,7 @@ DEFAULTS = {
|
|||
"GRAPHIQL_INPUT_VALUE_DEPRECATION": False,
|
||||
"ATOMIC_MUTATIONS": False,
|
||||
"TESTING_ENDPOINT": "/graphql",
|
||||
"MAX_VALIDATION_ERRORS": None,
|
||||
}
|
||||
|
||||
if settings.DEBUG:
|
||||
|
|
|
@ -336,7 +336,12 @@ class GraphQLView(View):
|
|||
)
|
||||
)
|
||||
|
||||
validation_errors = validate(schema, document, self.validation_rules)
|
||||
validation_errors = validate(
|
||||
schema,
|
||||
document,
|
||||
self.validation_rules,
|
||||
graphene_settings.MAX_VALIDATION_ERRORS,
|
||||
)
|
||||
|
||||
if validation_errors:
|
||||
return ExecutionResult(data=None, errors=validation_errors)
|
||||
|
|
Loading…
Reference in New Issue
Block a user