Skip to content
Branch: master
Find file Copy path
Find file Copy path
3 contributors

Users who have contributed to this file

@spawnia @lorado @chescos
80 lines (59 sloc) 2.23 KB

Upgrade guide

This document provides guidance for upgrading between major versions of Lighthouse.

General tips

The configuration options often change between major versions. Compare your lighthouse.php against the latest default configuration.

v4 to v5

Replace @middleware with @guard and specialized FieldMiddleware

The @middleware directive has been removed, as it violates the boundary between HTTP and GraphQL request handling.

Authentication is one of most common use cases for @middleware. You can now use the @guard on selected fields.

type Query {
- profile: User! @middlware(checks: ["auth"])
+ profile: User! @guard

Other functionality can be replaced by a custom FieldMiddleware directive. Just like Laravel Middleware, it can wrap around individual field resolvers.

@orderBy argument renamed to column

The argument to specify the column to order by when using @orderBy was renamed to column to match the @whereConditions directive.

Client queries will have to be changed like this:

    posts (
        orderBy: [
-               field: POSTED_AT
+               column: POSTED_AT
                order: ASC
    ) {

If you absolutely cannot break your clients, you can re-implement @orderBy in your project - it is a relatively simple ArgManipulator directive.

@modelClass and @model changed

The @model directive was repurposed to take the place of @modelClass. As a replacement for the current functionality of @model, the new @node directive was added, see for details.

You can adapt to this change in two refactoring steps that must be done in order:

  1. Rename all usages of @model to @node, e.g.:

    -type User @model {
    +type User @node {
        id: ID! @globalId
  2. Rename all usages of @modelClass to @model, e.g.

    -type PaginatedPost @modelClass(class: "\\App\\Post") {
    +type PaginatedPost @model(class: "\\App\\Post") {
        id: ID!
You can’t perform that action at this time.