-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove redundant call to validate #1393
Conversation
The call to `validate` in the django view is redundant with the validation call in graphql-core.
Thanks for opening the PR! While this PR brings a big reduction in overhead, we still have some unnecessary overhead left due to the call of For reference, this is how GQL-Core handles execution of a query string: #excerpt of graphql core's graphql_impl
"""Execute a query, return asynchronously only if necessary."""
# Validate Schema
schema_validation_errors = validate_schema(schema)
if schema_validation_errors:
return ExecutionResult(data=None, errors=schema_validation_errors)
# Parse
try:
document = parse(source)
except GraphQLError as error:
return ExecutionResult(data=None, errors=[error])
# Validate
from .validation import validate
validation_errors = validate(schema, document)
if validation_errors:
return ExecutionResult(data=None, errors=validation_errors)
# Execute, just move this call into graphene-django instead of graphene
return execute(
schema, # replace with graphene_schema.graphql_schema
document,
root_value,
context_value,
variable_values,
operation_name,
field_resolver,
type_resolver,
None,
middleware,
execution_context_class,
is_awaitable,
) Since 2/3 of this logic is already duplicated in the present |
Thank you for pin pointing this! Will look into it with @mohsam97 |
@shukryzablah Hello! Can you please the failing test? its just |
* Remove redundant call to validate The call to `validate` in the django view is redundant with the validation call in graphql-core. * Remove whitespace --------- Co-authored-by: Firas K <3097061+firaskafri@users.noreply.github.com>
|
The call to
validate
in the django view is redundant with the validation call in graphql-core. Related to #1198