Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom pagination clsss #883

Open
1 task
philkobby opened this issue Aug 22, 2024 · 1 comment
Open
1 task

Custom pagination clsss #883

philkobby opened this issue Aug 22, 2024 · 1 comment
Labels
enhancement New feature or request validated

Comments

@philkobby
Copy link

philkobby commented Aug 22, 2024

Scribe version

4.37

Your question

Hi, I have a custom pagination class that extends Illuminate\Pagination\LengthAwarePaginator, and it's been bound in the service container. This works fine with the paginate() method. However, Scribe seems to instantiate the Illuminate\Pagination\LengthAwarePaginator class directly, which overrides the custom pagination class when generating documentation.

  #[ResponseFromApiResource(
        TaskCollection::class,
        Task::class,
        paginate: 15,
        status: 200,
        description: 'Request was successful',
        collection: true,
    )]

    public function index(Request $request)
    {
        return new TaskCollection(Task::paginate(15));
        //paginations are generated as expected but the documentation does not follow the same format as expected
    }

Is there a workaround for Scribe to resolve the custom pagination class instead of Illuminate\Pagination\LengthAwarePaginator?

Docs

@shalvah
Copy link
Contributor

shalvah commented Aug 24, 2024

I guess we could change it to go through the service container. PR welcome!

@shalvah shalvah closed this as completed Aug 24, 2024
@shalvah shalvah reopened this Aug 24, 2024
@shalvah shalvah added validated enhancement New feature or request and removed triage question labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request validated
Projects
None yet
Development

No branches or pull requests

2 participants