-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pagination: enforce
nonNull
on the inner type as well as on the list
- Loading branch information
Showing
8 changed files
with
289 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
namespace Rebing\GraphQL\Tests\Support\Queries; | ||
|
||
use Closure; | ||
use GraphQL\Type\Definition\ResolveInfo; | ||
use GraphQL\Type\Definition\Type; | ||
use Illuminate\Contracts\Pagination\LengthAwarePaginator; | ||
use Rebing\GraphQL\Support\Facades\GraphQL; | ||
use Rebing\GraphQL\Support\Query; | ||
use Rebing\GraphQL\Tests\Support\Models\Post; | ||
|
||
class PostNonNullPaginationQuery extends Query | ||
{ | ||
protected $attributes = [ | ||
'name' => 'postNonNullPaginationQuery', | ||
]; | ||
|
||
public function type(): Type | ||
{ | ||
return GraphQL::paginate(GraphQL::type('PostWithModel')->toString()); | ||
} | ||
|
||
public function resolve($root, $args, $context, ResolveInfo $resolveInfo, Closure $getSelectFields): LengthAwarePaginator | ||
{ | ||
return Post::query() | ||
->select($getSelectFields()->getSelect()) | ||
->paginate(); | ||
} | ||
} |
Oops, something went wrong.