hussein4alaa / laravel-g4t-swagger-auto-generate

auto generate swagger in laravel
MIT License
106 stars 13 forks source link

Invokable API Controller and routes #33

Closed chrisrhymes closed 7 months ago

chrisrhymes commented 7 months ago

Describe the bug When you use invokable routes and controllers, you get the following error:

Undefined array key 1 {"exception":"[object] (ErrorException(code: 0): Undefined array key 1 at /var/www/html/vendor/g4t/swagger/src/Helpers.php:55)

To Reproduce

  1. Create an API controller, for example UserController, with an __invoke() method.
  2. Add the route to the routes/api.php file. No method name is needed as Laravel will default to using the __invoke() method in the Controller.
    Route::get('/users', UserController::class)
     ->name('users');
  3. Visit /swagger/documentation and see the above error.

Expected behavior It would be great to allow invokable controllers and routes if possible. It errors as there is no @ in the $controllerMethod for invokable routes.

hussein4alaa commented 7 months ago

@chrisrhymes I am very grateful for your notice I will solve it and inform you as soon as possible

hussein4alaa commented 7 months ago

@chrisrhymes Please upgrade the package to 3.0.4 It will work fine Thank you for submitting an issue report

chrisrhymes commented 7 months ago

Thank you @hussein4alaa!

hussein4alaa commented 7 months ago

@chrisrhymes Your welcome, I would be grateful if you could report any issue you may encounter