DarkaOnLine / L5-Swagger

OpenApi or Swagger integration to Laravel
https://github.com/DarkaOnLine/L5-Swagger
MIT License
2.64k stars 394 forks source link

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

Closed Rasoul-Karimi closed 1 month ago

Rasoul-Karimi commented 1 year ago

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"

roman-rr commented 1 year ago

Same for me after composer update

Rasoul-Karimi commented 1 year ago

yes after composer update

jangidgirish commented 1 year ago

same error after update

mawebdev commented 1 year ago

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"
    },
DerManoMann commented 1 year ago

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

CleisonPaiva commented 1 year ago

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

Rasoul-Karimi commented 1 year ago

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

DarkaOnLine commented 1 year ago

@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

Rasoul-Karimi commented 1 year ago

@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

DarkaOnLine commented 1 year ago

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

GalinaBublik commented 1 year ago

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

/**

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

Outsidaz commented 1 year ago

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

sajid-deltashoppe commented 1 year ago

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

vicanicius commented 6 months ago

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?

DerManoMann commented 6 months ago

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