laravel-openapi icon indicating copy to clipboard operation
laravel-openapi copied to clipboard

No option to resolve custom collection.

Open noitran opened this issue 4 years ago • 1 comments

Right now the package has the functionality to create multiple collections, but there is no option to serve them on multiple routes. Example:

/api/public/docs
/api/private/docs

Because OpenApiController does not receive a collection flag and uses a "default" one.

class OpenApiController
{
    public function show(Generator $generator): OpenApi
    {
        return $generator->generate();
    }
}

There should be a way to pass collection:

    public function show(Generator $generator): OpenApi
    {
        return $generator->generate($collectionName);
    }

Or it should take from config. I can help, but which way would be preferable? Or add a custom controller setting to the config?

noitran avatar May 24 '21 11:05 noitran

Right now the package has the functionality to create multiple collections, but there is no option to serve them on multiple routes. Example:

/api/public/docs
/api/private/docs

Because OpenApiController does not receive a collection flag and uses a "default" one.

class OpenApiController { public function show(Generator $generator): OpenApi { return $generator->generate(); } } There should be a way to pass collection:

public function show(Generator $generator): OpenApi
{
    return $generator->generate($collectionName);
}

Or it should take from config. I can help, but which way would be preferable? Or add a custom controller setting to the config?

Unfortunately, it seems this package may have been abandoned, but I've put some notes together on how I've managed to use the Collections feature here in case anyone else stumbles upon this: https://github.com/vyuldashev/laravel-openapi/pull/118

gavg-vaioni avatar Feb 19 '25 09:02 gavg-vaioni