Better log message for unsupported http method

This commit is contained in:
Floran Brutel 2018-04-20 17:24:28 +02:00
parent 22c6eb5958
commit de8704f643
No known key found for this signature in database
GPG Key ID: 5F489E97DDFCBEBC

View File

@ -209,10 +209,10 @@ final class SwaggerPhpDescriber implements ModelRegistryAwareInterface
$path = $this->normalizePath($route->getPath()); $path = $this->normalizePath($route->getPath());
$httpMethods = $route->getMethods() ?: Swagger::$METHODS; $httpMethods = $route->getMethods() ?: Swagger::$METHODS;
$httpMethods = array_map('strtolower', $httpMethods); $httpMethods = array_map('strtolower', $httpMethods);
$validHttpMethods = array_intersect($httpMethods, Swagger::$METHODS); $supportedHttpMethods = array_intersect($httpMethods, Swagger::$METHODS);
if (empty($validHttpMethods)) { if (empty($supportedHttpMethods)) {
$this->logger->warning('No valid HTTP method for path', [ $this->logger->warning('None of the HTTP methods specified for path {path} are supported by swagger-ui, skipping this path', [
'path' => $path, 'path' => $path,
'methods' => $httpMethods, 'methods' => $httpMethods,
]); ]);
@ -220,7 +220,7 @@ final class SwaggerPhpDescriber implements ModelRegistryAwareInterface
continue; continue;
} }
yield $method => [$path, $validHttpMethods]; yield $method => [$path, $supportedHttpMethods];
} }
} }
} }