Closed Floppy012 closed 10 months ago
Not sure I understand what you mean by "enabling the pagination", but note that you can add a custom strategy to automatically add some parameters to certain endpoints. I believe there's an example in the docs.
Not sure I understand what you mean by "enabling the pagination", but note that you can add a custom strategy to automatically add some parameters to certain endpoints. I believe there's an example in the docs.
@shalvah I'm sorry. I should've provided more information:
The docs state that one can provide attributes such as #[ResponseFromApiResource]
. Those attributes have the pagination
parameter. When setting that parameter, the generated response body in the documentation is that of Laravel's paginate
function. paginate
uses the page
parameter of the HTTP request. My question was whether there is a way that this query parameter could also be generated in the documentation without having to add it manually.
Ah, no, that's not supported. I'm not sure we should support that, as it can be quite opinionated (what parameter names to use).
Btw, if you're using attributes, you can consider creating your own attribute which extends the ones provided by Scribe. This way, Scribe can read the attribute and generate the response, and you can add a custom strategy that adds the query parameters from there. (It's fairly easy if you follow the examples in Scribe.)
Heck, you don't even need a custom attribute here. Just a strategy that adds the query parameters to an endpoint if it has this attribute, if that's what you want.
Scribe version
4.22.0
Your question
Is there a way to generate the
page
query parameter when enabling thepagination
of an API response? Or do I have to add it manually?Docs