Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional Parameters not working when using prefixed group #915

Open
1 task done
s1ghn opened this issue Nov 6, 2024 · 2 comments
Open
1 task done

Optional Parameters not working when using prefixed group #915

s1ghn opened this issue Nov 6, 2024 · 2 comments
Labels
bug Something isn't working help wanted Contributions from the community are encouraged

Comments

@s1ghn
Copy link

s1ghn commented Nov 6, 2024

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 s1ghn added bug Something isn't working triage labels Nov 6, 2024
@s1ghn
Copy link
Author

s1ghn commented Nov 6, 2024

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

@shalvah
Copy link
Contributor

shalvah commented Feb 3, 2025

Ugh, optional parameters (especially in the middle) are one of my annoyances. Popping in to let you know I see this, but it's unlikely I'll get time to look at it soon. Any help is welcome.

@shalvah shalvah added help wanted Contributions from the community are encouraged and removed triage labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Contributions from the community are encouraged
Projects
None yet
Development

No branches or pull requests

2 participants