knuckleswtf / scribe

Generate API documentation for humans from your Laravel codebase.✍
https://scribe.knuckles.wtf/laravel/
MIT License
1.7k stars 303 forks source link

Extracting rules from form requests leveraging Laravel DI on rules method #707

Closed aledeg closed 1 year ago

aledeg commented 1 year ago

Scribe version

4.18.0

Your question

I am using form requests to generate my documentation. It was working well until I hit a dead-end while working a form request that leverage Laravel dependency injection in the rules method.

I've checked the code where the rules method is called on the form request. The call is made without parameters. Thus explaining why the documentation cannot be generated.

I was wondering if there is something I can do with the current state of the library. If not, it could be nice to have a hook similar for the form request instantiation but for the rules extraction.

I've already tried to use the form request instantiation by changing the DI on my form request but because of the number of parameters used in the extended class, it is not very readable. It works but it is dirty. I find it clearer to stick with Laravel DI in the rules method.

Thank you.

Docs

shalvah commented 1 year ago

This should be possible now on the master branch (https://github.com/knuckleswtf/scribe/commit/84078358ce32ff0656a9ab03f062e952f721f1a2)

aledeg commented 1 year ago

Great! I can't wait to use it. Thank you @shalvah!