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

SuccessResponseGenerator is missing methods #41

Open
trinvh opened this issue Apr 18, 2020 · 3 comments
Open

SuccessResponseGenerator is missing methods #41

trinvh opened this issue Apr 18, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@trinvh
Copy link

trinvh commented Apr 18, 2020

  • Laravel Swagger Version: v0.7.x-dev
  • Laravel Version: 6.0.x
  • PHP Version: 7.3

Description:

If there is a route with PATCH method an error will be thrown: Undefined index: patch

Fixed it in SuccessResponseGenerator.php:

$methodMappingHttpCode = [
            'head' => 200,
            'get' => 200,
            'post' => 201,
            'put' => 204,
            'delete' => 204,
            'patch' => 204,
        ];

Another issue when I'm using laravel-debugbar in src/DataObjects/Route.php line #78 since middleware constructor only accept string, so I had to hack it like this

protected function formatMiddleware()
    {
        return array_map(function ($middleware) {
            if (gettype($middleware) !== 'string') {
                // dd($middleware);
                return new Middleware('ignored');
            }
            return new Middleware((string)$middleware);
        }, $this->route->gatherMiddleware());
    }

Tried to dump the $middleware object then I got:

^ Closure($request, $next)^ {#1346
  class: "Barryvdh\Debugbar\Controllers\BaseController"
  this: Barryvdh\Debugbar\Controllers\OpenHandlerController {#1345 …}
}

Another issue again:
Is this package dependant to laravel-passport? Tried to disable parseSecurity to false but it was still required. I had to install laravel-passport and configure it to make this package working

@trinvh trinvh added the bug Something isn't working label Apr 18, 2020
@mtrajano
Copy link
Owner

Hey thank you for submitting this issue I'll look into this tonight. laravel-passport is only required for local development (testing) when installing the package make sure to pass the --no-dev flag in order not to pull any dev packages (phpunit, laravel-passport, etc.). If the package is breaking because you're missing laravel-passport (with the parseSecurity) option set to false than that is a bug and I'll look into it as well.

@mtrajano
Copy link
Owner

@trinvh I pushed a fix for the missing methods in the v0.7.x-dev branch, sorry about that. I will look into parseSecurity issue tomorrow, thanks for reporting!

@trinvh
Copy link
Author

trinvh commented Apr 30, 2020

Great work @mtrajano . Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants