Skip to content

Releases: nuwave/lighthouse

Remove backticks in QueryBuilder (Postgres)

25 Apr 23:23
Compare
Choose a tag to compare
v2.0.3

remove backticks (postgres)

Initial Lumen Support

23 Apr 03:35
b4873c3
Compare
Choose a tag to compare
Initial Lumen Support Pre-release
Pre-release

Thanks to the help of @4levels and @kikoseijo, Lumen has initial support! If you run into any problems please submit an issue!

Client Directives

23 Apr 03:12
Compare
Choose a tag to compare
Client Directives Pre-release
Pre-release

You can now define client side directives in your schema files. Some helper methods/traits will be provided in the future that you can use to help resolve those directives.

Server Side

# Server Side - Defines a client directive that can be applied to fields
directive @cache(key: String) on FIELD

# ...
type Query {
  foo: String
}

Client Side

query Foo {
  foo @cache("client-cache-key")
}

Include default eager loads

19 Apr 21:07
Compare
Choose a tag to compare

If you're using the hasMany directive and you're connected model has default eager loading Lighthouse will now pull in those relations automatically.

For example, if you have a model:

class Post extends Model
{
    protected $with = ['comments'];
}

a schema like this:

type Post {
  author: [Comment!]! @hasMany
}

Lighthouse will automatically eager load the author relationship whenever a Post type is queried.

Eloquent Argument Filters

16 Apr 01:27
Compare
Choose a tag to compare
Pre-release

Created @where, @whereBetween, @whereNotBetween, @eq, @notEq, @in, @notIn argument directives to filter queries.

type User {
  id: ID!
  name: String
  email: String
}

type Query {
  # filter users with an `id` in the provided array
  users(include: [Int] @in(key: "id")): [User!]!
    @paginate(model: "Tests\\\Utils\\\Models\\\User")
}

Until docs are released, check out the tests here.

Add missing facade

11 Apr 15:56
Compare
Choose a tag to compare
v2.0.1

add missing facade

Allow custom error formatting

11 Apr 16:04
Compare
Choose a tag to compare
Pre-release
namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register()
    {
        // ...

       // Register custom error formatting
        \GraphQL::error(function ($error, $e) {
            $previous = $e->getPrevious();

            if ($previous && $previous instanceof \Nuwave\Lighthouse\Support\Exceptions\ValidationError) {
                $error['status_code'] = 422;
            }

            return $error;
        });
    }
}

Custom Validators

10 Apr 22:19
Compare
Choose a tag to compare
Custom Validators Pre-release
Pre-release

First, create a class that extends the new validator

// app/Http/GraphQL/Validators/MyCustomValidator.php

use Nuwave\Lighthouse\Support\Validator\Validator;

class MyCustomValidator extends Validator
{
    public function rules()
    {
        // return array of rules...
    }
}

Add validate directive to your schema:

extend type Mutation {
  createFoo(input: FooInput!): FooPayload
    @validate(validator: "App\\Http\\GraphQL\\Validators\\MyCustomValidator")
}

Lighthouse v2.0

09 Apr 05:14
Compare
Choose a tag to compare
v2.0.0

lighthouse version 2.0

Walkthrough Release

07 Apr 21:33
Compare
Choose a tag to compare
Walkthrough Release Pre-release
Pre-release

Final pre-release before v2.0 which will be cut tonight or tomorrow!