nuwave / nuwave/lighthouse

Intertwine order of optional field middleware with global field middleware

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

Nobody has claimed this yet.

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

Description

What problem does this feature proposal attempt to solve?

Since Lighthouse v5, it is possible to define the order of global field middleware: https://github.com/nuwave/lighthouse/pull/1533

However, this does not allow for optional field middleware - such as @guard - to be intertwined within the global field middleware. In the case of @guard, it may be particularly useful to run it before validation.

Which possible solutions should be considered?

Perhaps the config can have two lists of middleware:

  1. Global field middleware that should always be included, unordered
  2. Order of any field middleware present on a field

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

No files or tests are named. Start by reviewing the global field middleware ordering introduced in pull request #1533 and the current middleware configuration; done should allow optional middleware such as @guard to be positioned among global field middleware, with coverage for ordering it before validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, laravel, php
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.