L5-Swagger: Error Installation

  • L5-Swagger Version: 7.0 (composer show | grep l5-swagger)
  • PHP Version (7.4.2):
  • OS: Windows10

Description: Composer :: TypeError

Argument 2 passed to L5Swagger\Generator::__construct() must be of the type string, null given, called in D:\ … \vendor\darkaonline\l5-swagger\src\L5SwaggerServiceProvider.php on line 66

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (5 by maintainers)

Most upvoted comments

Hi there,

As others have mentioned, it looks like the issue is being caused by some cache that could exist in your Laravel application.

The steps I followed to solve the problem:

  1. composer remove "darkaonline/l5-swagger" Remove the package to ensure that any reference to the package no longer exists. You have to do this otherwise the next command will fail.

  2. php artisan config:clear The above clears your config.

  3. composer require "darkaonline/l5-swagger" Reinstall the package. All should be well now.

doing php artisan config:clear fixed this issue for me

I think, problem is config cache

Hello everyone, I have the same problem, i have fixed it on deleting all files into bootstrap/cache (config/packages/routes-v7/services) and then run php artisan optimize Hope it’s help

Ohhhh I think I understood now… Maybe the problem is the Windows \

The library is concatenating with the Unix /.

$docDir = config('l5-swagger.paths.docs');
$docsFile = $docDir .'/'. config('l5-swagger.paths.docs_json', 'api-docs.json');
$yamlDocsFile = $docDir .'/'. config('l5-swagger.paths.docs_yaml', 'api-docs.yaml');

Replace the Unix / to the php const DIRECTORY_SEPARATOR, may fix it

$docDir = config('l5-swagger.paths.docs');
$docsFile = $docDir . DIRECTORY_SEPARATOR . config('l5-swagger.paths.docs_json', 'api-docs.json');
$yamlDocsFile = $docDir . DIRECTORY_SEPARATOR . config('l5-swagger.paths.docs_yaml', 'api-docs.yaml');

Same issue, 7.4.4 Ubuntu 18.04

After installation, we dont have config file, so $ php artisan vendor:publish --provider "L5Swagger\L5SwaggerServiceProvider" throw same error.