I am using the doc generator with 'methods' => ['*'] because I want to dump sample requests for the POST requests. But, it appears that the values in @bodyParam are not getting attached to the request.
Here is a quick reproduction of the issue. My function looks like this:
/**
* Sample Request
*
* Generates a sample request
*
* @queryParam query_id int required The variable being sent to the query id Example: 123
* @bodyParam body_id int required The variable being sent to the body id Example: 456
*/
public function index()
{
return request()->all();
}
And, the response I'm getting in the docs is:
{
"query_id": "123"
}
But, if I perform the sample curl request from the command line, I get my expected response:
{"body_id":456,"query_id":"123"}
I've looked in ResponseCalls and can get it to work correctly if I modify addBodyParameters to:
private function addBodyParameters(Request $request, array $body)
{
$request->request->add($body);
$request->query->add($body);
return $request;
}
but I'm not familiar enough with the Request object to know if that's an acceptable solution.
Fixed in 4.0.2 (https://github.com/mpociot/laravel-apidoc-generator/commit/5d9371c14391485630941c718d7f168afd540126)
Most helpful comment
Fixed in 4.0.2 (https://github.com/mpociot/laravel-apidoc-generator/commit/5d9371c14391485630941c718d7f168afd540126)