Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Rasoul-Karimi opened this issue Jan 19, 2023 · 15 comments
Open

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

Rasoul-Karimi opened this issue Jan 19, 2023 · 15 comments

Comments

@Rasoul-Karimi
Copy link

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

@roman-rr
Copy link

Same for me after composer update

@Rasoul-Karimi
Copy link
Author

yes after composer update

@jangidgirish
Copy link

same error after update

@mawebdev
Copy link

mawebdev commented Jan 24, 2023

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
Copy link

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

@CleisonPaiva
Copy link

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
Copy link
Author

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

@DarkaOnLine
Copy link
Owner

@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
Copy link
Author

Rasoul-Karimi commented Feb 22, 2023

@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
Copy link
Owner

DarkaOnLine commented Feb 22, 2023

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

@GalinaBublik
Copy link

GalinaBublik commented Apr 5, 2023

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

@Outsidaz
Copy link

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
Copy link

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
Copy link

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
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests