diff --git a/src/Mappers/PaginatorTypeMapper.php b/src/Mappers/PaginatorTypeMapper.php index e110a77..b242c5f 100644 --- a/src/Mappers/PaginatorTypeMapper.php +++ b/src/Mappers/PaginatorTypeMapper.php @@ -104,54 +104,54 @@ private function getObjectType(bool $countable, OutputType $subType): MutableInt 'firstItem' => [ 'type' => Type::int(), 'description' => 'Get the "index" of the first item being paginated.', - 'resolve' => static function (Paginator $root): int { + 'resolve' => static function (Paginator $root): ?int { return $root->firstItem(); }, ], 'lastItem' => [ 'type' => Type::int(), 'description' => 'Get the "index" of the last item being paginated.', - 'resolve' => static function (Paginator $root): int { + 'resolve' => static function (Paginator $root): ?int { return $root->lastItem(); }, ], 'hasMorePages' => [ - 'type' => Type::boolean(), + 'type' => Type::nonNull(Type::boolean()), 'description' => 'Determine if there are more items in the data source.', 'resolve' => static function (Paginator $root): bool { return $root->hasMorePages(); }, ], 'perPage' => [ - 'type' => Type::int(), + 'type' => Type::nonNull(Type::int()), 'description' => 'Get the number of items shown per page.', 'resolve' => static function (Paginator $root): int { return $root->perPage(); }, ], 'hasPages' => [ - 'type' => Type::boolean(), + 'type' => Type::nonNull(Type::boolean()), 'description' => 'Determine if there are enough items to split into multiple pages.', 'resolve' => static function (Paginator $root): bool { return $root->hasPages(); }, ], 'currentPage' => [ - 'type' => Type::int(), + 'type' => Type::nonNull(Type::int()), 'description' => 'Determine the current page being paginated.', 'resolve' => static function (Paginator $root): int { return $root->currentPage(); }, ], 'isEmpty' => [ - 'type' => Type::boolean(), + 'type' => Type::nonNull(Type::boolean()), 'description' => 'Determine if the list of items is empty or not.', 'resolve' => static function (Paginator $root): bool { return $root->isEmpty(); }, ], 'isNotEmpty' => [ - 'type' => Type::boolean(), + 'type' => Type::nonNull(Type::boolean()), 'description' => 'Determine if the list of items is not empty.', 'resolve' => static function (Paginator $root): bool { return $root->isNotEmpty(); @@ -161,13 +161,13 @@ private function getObjectType(bool $countable, OutputType $subType): MutableInt if ($countable) { $fields['totalCount'] = [ - 'type' => Type::int(), + 'type' => Type::nonNull(Type::int()), 'description' => 'The total count of items.', 'resolve' => static function (LengthAwarePaginator $root): int { return $root->total(); }]; $fields['lastPage'] = [ - 'type' => Type::int(), + 'type' => Type::nonNull(Type::int()), 'description' => 'Get the page number of the last available page.', 'resolve' => static function (LengthAwarePaginator $root): int { return $root->lastPage();