Open aledeg opened 1 year ago
First off, the standard warning: there is no single standard for query parameters as objects/arrays. https://blog.shalvah.me/posts/fun-stuff-representing-arrays-and-objects-in-query-strings
Re your question: this might work. Try adding a top-level page
rule, something like:
return [
'page' => ['object'],
'page.size' => [ ... ],
];
This should make Scribe see it as an object with a nested field.
Thank you for your answer. I've tried that but unfortunately, it does not work.
Could it be possible to be able to override parameter names in the queryParameters
method? This way, it will be easy to customize without compromising the existing behavior.
To clarify, the only problem here is the parameter name displayed in the HTML and Postman collection? Other things, like Try It Out, work as expected, yeah?
I haven't tried that. To be honest, I've never used that. I'll try and get back to you.
So, I've made some tests. Try It Out works with my parameter as page.size
. But it does not work when using in the Postman collection.
While using the collection, I need to manually change page.size
to page[size]
.
Hmmm 🤔
I have defined a route using a form request to handle my query parameters. When I make requests on my route, the filter handled by the query parameter is working properly but the documentation does not reflect how to use them. My filter is defined as
filter.something
in the form request. It is documented asfilter.something
both in the HTML file and the Postman collection. But in order to trigger it, I need to inputfilter[something]
in the URL. This makes both the HTML file and the Postman collection useless.Am I missing something ?
Here is an example of a form request I use in an index resource request:
This renders into: And:
When I try to apply the later while making a Postman request, it has no effect unless I rewrite it to
page[size]
.I have tried to rewrite the name on the code level by leveraging the
queryParameters
method but it does not support such thing.What will be the best course of action to overcome this situation? Is there something I could to on my hand or is it something the library should handle?
Thank you
My environment:
php -v
): PHP 8.1.11 (cli) (built: Sep 29 2022 22:17:15) (NTS)composer show laravel/framework
orcomposer show laravel/lumen-framework
): v9.43.0composer show knuckleswtf/scribe
): 4.17.0My Scribe config (from
php artisan scribe:config:diff
):