L5-Swagger: error Class \"OpenApi\\Generator\" not found

  • L5-Swagger Version: #.#.# (8.1)
  • PHP Version 8.2:
  • OS: Ubuntu

Description:

i get this error : Class "OpenApi\Generator" not found I remove the vendor directory and composer install again but not working

exception : "Error" file : "vendor/darkaonline/l5-swagger/src/Generator.php" line : 176 message : "Class \"OpenApi\\Generator\" not found"

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 5
  • Comments: 15 (2 by maintainers)

Most upvoted comments

It has to do with the package zircode/swagger-php.

darkaoline/l5-swagger requires "zircode/swagger-php where the OpenApi/Generator should be.

For any reasons, the Generator Class isn’t available in the installed version of zircode/swagger-php, which will be installed as a dependency of darkaonline/l5-swagger.

Installing the lastest 3.x version, (which is 3.3.7) of zircode/swagger-php from the projects composer.json fixes this issue as a workaround (Tested with 8.1.0):

Add this to your composer.json and run composer update:

"require": {
        ...,
        "zircote/swagger-php": "3.3.7"
    },

Good answer. Looks like a bug here as L5 only requires ^3 which obviously is wrong.