knuckleswtf / scribe

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

Optional Parameters not working when using prefixed group #915

Open s1ghn opened 4 weeks ago

s1ghn commented 4 weeks ago

Scribe version

4.37

PHP version

8.3.9

Framework

Laravel

Framework version

11.28

Scribe config

static.output_path => "docs"
laravel.add_routes => false
laravel.docs_url => "/"
auth.enabled => true
auth.default => true
auth.use_value => "xxxxx"

What happened?

When generating the api docs, routes which

a) have an optional parameter b) are prefixed by a Route::prefix()->group(...)

are missing prefixes and the optional parameter.

You can verify by creating this example:

Route::prefix('users')->name('users.')->group(function () {
    Route::get('{user?}/show', fn () => 'hello')->name('show');
});

Expected result:

users/{user?}/show

Actual result:

//show

This issue does not appear however when using non optional parameters.

Docs

s1ghn commented 4 weeks ago

Update: It works again when nesting another prefix, and putting the route in there