L5-Swagger icon indicating copy to clipboard operation
L5-Swagger copied to clipboard

error Class \"OpenApi\\Generator\" not found

Open Rasoul-Karimi opened this issue 2 years ago • 15 comments

  • 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"

Rasoul-Karimi avatar Jan 19 '23 09:01 Rasoul-Karimi

Same for me after composer update

roman-rr avatar Jan 19 '23 17:01 roman-rr

yes after composer update

Rasoul-Karimi avatar Jan 21 '23 09:01 Rasoul-Karimi

same error after update

jangidgirish avatar Jan 24 '23 05:01 jangidgirish

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"
    },

mawebdev avatar Jan 24 '23 07:01 mawebdev

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

DerManoMann avatar Jan 24 '23 07:01 DerManoMann

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"
    },

it worked for me

CleisonPaiva avatar Jan 24 '23 12:01 CleisonPaiva

please update the package and release fixed version @collegeman @DarkaOnLine @verwilst @StyleCIBot @ashish-khokhar @rlems @ymhuang0808 @rodrigowbazevedo @firdaushatta

Rasoul-Karimi avatar Feb 22 '23 07:02 Rasoul-Karimi

@Rasoul-Karimi what is wrong with package requirements? We have swagger-php: "^3.2.0 || ^4.0.0"

https://github.com/DarkaOnLine/L5-Swagger/blob/master/composer.json#L24

DarkaOnLine avatar Feb 22 '23 07:02 DarkaOnLine

@DarkaOnLine after update i get new error!! now i have too many documents and work fine with version 8.1 but after update to 8.5 or master get this error:

Required @OA\Info() not found

i dont need to get a new error! :) i want to only fix this one: error Class "OpenApi\Generator" not found

Rasoul-Karimi avatar Feb 22 '23 07:02 Rasoul-Karimi

Have you checked this for @OA\Info() problem: https://zircote.github.io/swagger-php/guide/faq.html#warning-required-oa-info-not-found

DarkaOnLine avatar Feb 22 '23 08:02 DarkaOnLine

Installed "darkaonline/l5-swagger": "8.1", because latest version 8.5 - return "Required https://github.com/OA\Info() not found" BUT i have

/**

  • @OA\Info(
  • title="OnePlusOne Solutions API",
    
  • version="1.0.0"
    
  • ) */

in my class Controller!!! Done composer require "zircote/swagger-php:3.*" - nothing changed (((

EDITED changed "darkaonline/l5-swagger": "8.1", to "darkaonline/l5-swagger": "^8.1", in composer composer update
And all working

GalinaBublik avatar Apr 05 '23 06:04 GalinaBublik

I can confirm, that after adding the downgraded swagger-php 3.x version to composer.json everything works fine: image

PHP: 8.2.4 Laravel: 9.52.5

Outsidaz avatar Apr 13 '23 11:04 Outsidaz

facing Error "Required @OA\Info() not found" its ttok my 1 day.

at vendor\zircote\swagger-php\src\Loggers\DefaultLogger.php:31

php: 8.1.13 laravel: 10.14.1

image

sajid-deltashoppe avatar Jul 20 '23 06:07 sajid-deltashoppe

facing Error "Required @OA\Info() not found" its ttok my 1 day.

at vendor\zircote\swagger-php\src\Loggers\DefaultLogger.php:31

php: 8.1.13 laravel: 10.14.1

image

Did you solve this?

vicanicius avatar Mar 26 '24 13:03 vicanicius

Could be this one: https://zircote.github.io/swagger-php/guide/faq.html#warning-required-oa-info-not-found

DerManoMann avatar Mar 26 '24 20:03 DerManoMann