nuwave / nuwave/lighthouse

Respect order of `@validator` compared to other field middleware directives

Open
#1,574 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
PHP
Stars
3.5k
Forks
468
Avg merge
3h 9m
Merged PRs (30d)
2

Description

If we have a simple mutation like this with both directives

createUser(input: inputUser! @spread): User
    @create
    @validator
    @can(ability: "create")

@validator is not respecting the order. I'm expecting to execute @can first instead I get validation errors.

I think @validator should respect the order in the fields directives

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown createUser mutation and trace the field-directive middleware path; the issue names no file or test. Reproduce the directive ordering and verify that @can runs before @validator when listed first, with the behavior covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.