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

can we have an ignore_hidden override pls? #746

Closed mooseh closed 6 months ago

mooseh commented 8 months ago

Scribe version

4.22.0

Your question

so a while back you added config support which is super helpful for those who need 2 sets of documentation this works great but I was wondering if we could add a 'ignore_hidden' to the config like so


    /*
     * The base URL displayed in the docs. If this is empty, Scribe will use the value of config('app.url').
     */
    'base_url' => null,

    /**
     * overide hidden items
     */

    'ignore_hidden' => true,

and then add the following lines in GroupedEndpointsFromApp

            if ($this->isRouteHiddenFromDocumentation($routeControllerAndMethod) && $this->docConfig->get('ignore_hidden') !== false) {
                c::warn('Skipping route: ' . c::getRouteRepresentation($route) . ': @hideFromAPIDocumentation was specified.');
                continue;
            }

this is so we can have an ALL documentation and then filtered documentations

Docs

shalvah commented 8 months ago

this is so we can have an ALL documentation and then filtered documentations

I don't get it. Can you elaborate, possibly with an example?

mooseh commented 8 months ago

so its a little tricky to explain but i have 2 configs, 1 for users and 1 for admins the admin routes for the documentation are gated so only admins can reach the /admin/docs path

I need the config/scribe_admin.php config file to have an override for the @hideFromAPIDocumentation such as ignore_hidden flag in the config.php so that admins get all the routes even if they are hidden.

maybe i am taking the wrong approach but I feel like this is a quick and helpful solution to my problem

shalvah commented 6 months ago

Closing this, as there's no plan to add this. This is what the routes -> match rules in the config file are for. In one config file, you can have 'exclude' => 'GET /some_endpoint' to exclude it from that doc.