knuckleswtf / scribe

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

RouteMatcher config option ignored #745

Closed Floppy012 closed 8 months ago

Floppy012 commented 8 months ago

Scribe version

4.25.0

PHP version

8.2.9

Framework

Laravel

Framework version

10.26.2

Scribe config

routeMatcher => "App\\Docs\\CustomRouteMatcher"

What happened?

When generating docs, the custom route matcher is not called. I am using a custom configuration file scribe-v1 with the --config option when generating. Generating itself works fine but its not using my custom route matcher. I've tried to find where that config option is being read but couldn't find anything.

Docs

shalvah commented 8 months ago

It's used here:

https://github.com/knuckleswtf/scribe/blob/46b5a2562184ba64002ecc744b54a2f5d2d9d3bf/src/ScribeServiceProvider.php#L33

I think it doesn't work because it's looking for scribe (so it doesn't support custom config).

I don't really like that config option anyway. Will probably deprecate it in future. I'm thinking, maybe it's better to just bind your preferred object yourself? Something like:

$this->app->bind(RouteMatcherInterface::class, RouteMatcher::class)

Although you have to ensure it's in a service provider loaded after Scribe's (or use contextual binding: when(GenerateDocumentation)->needs(...)->give(...)).