Skip to content

Execution after validation failed.  #92

Closed
@yckao

Description

@yckao

Hi,
I'm writing complexity validator.
But I found that still processing query after return 400.
And the point is in koa-graphgl/dist/index.js line 132 ~ 138

        // Validate AST, reporting any errors.
        var validationErrors = (0, _graphql.validate)(schema, documentAST, validationRules);
        if (validationErrors.length > 0) {
          // Return 400: Bad Request if any validation errors exist.
          response.status = 400;
          resolve({ errors: validationErrors });
        }

And it can simple change by add return after calling resolve.

In express-graphql implementation it will not continue execution after validation failed.

Maybe we can add a option to determine whether it should be execute after validation failed or not.
It would be great.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions