scribe icon indicating copy to clipboard operation
scribe copied to clipboard

BodyParam attribute does not work in FormRequest

Open aleksejjj opened this issue 3 years ago • 2 comments

Hello. What about BodyParam attribute in FormRequest?

This works:

/**
 * @bodyParam phone string  ....
 */
class CodeRequest extends FormRequest
{
    // ...
}

This does not:

#[BodyParam(name: 'phone', type: 'string')]
class CodeRequest extends FormRequest
{
   // ...
}

php artisan scribe:generate output:

ⓘ Processing route: [POST] api/auth/code
⚠ No bodyParameters() method found in App\Http\Requests\Auth\CodeRequest. Scribe will only be able to extract basic information from the rules() method.

Can it be done without bodyParameters() method?

aleksejjj avatar Dec 11 '22 07:12 aleksejjj

The console output (although misleading) doesn't by itself mean it doesn't work. Does it show up in your generated docs? I'm not sure, but i think that works. If it doesn't, that's an ommission to be fixed.

shalvah avatar Dec 11 '22 09:12 shalvah

ALso: you'll complain I'm being unfair if I close this issue, but you created a bug issue, and simply deleted the bug template without answering any of the questions there. Why> They're Not there because I have a fetish for questions. For instance, without you specifying the version, how would I know whether this has been corrected in later versions?

shalvah avatar Dec 11 '22 10:12 shalvah