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 500 Zircote in swagger in new version 3.0.3 #32

Open
matiasr2503 opened this issue Jun 28, 2022 · 3 comments
Open

Error 500 Zircote in swagger in new version 3.0.3 #32

matiasr2503 opened this issue Jun 28, 2022 · 3 comments

Comments

@matiasr2503
Copy link

yii\base\ErrorException: Skipping unknown \__Application in /app/vendor/zircote/swagger-php/src/Loggers/DefaultLogger.php:31
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError(512, 'Skipping unknow...', '/app/vendor/zir...', 31, Array)
#1 /app/vendor/zircote/swagger-php/src/Loggers/DefaultLogger.php(31): trigger_error('Skipping unknow...', 512)
#2 /app/vendor/psr/log/Psr/Log/AbstractLogger.php(85): OpenApi\Loggers\DefaultLogger->log('warning', 'Skipping unknow...', Array)
#3 /app/vendor/zircote/swagger-php/src/Analysers/ReflectionAnalyser.php(80): Psr\Log\AbstractLogger->warning('Skipping unknow...')
#4 /app/vendor/zircote/swagger-php/src/Analysers/ReflectionAnalyser.php(54): OpenApi\Analysers\ReflectionAnalyser->analyzeFqdn('\\__Application', Object(OpenApi\Analysis), Array)
#5 /app/vendor/zircote/swagger-php/src/Generator.php(433): OpenApi\Analysers\ReflectionAnalyser->fromFile('/app/config/__a...', Object(OpenApi\Context))
#6 /app/vendor/zircote/swagger-php/src/Generator.php(396): OpenApi\Generator->scanSources(Object(Symfony\Component\Finder\Finder), Object(OpenApi\Analysis), Object(OpenApi\Context))
#7 /app/vendor/zircote/swagger-php/src/Generator.php(348): OpenApi\Generator->generate(Object(Symfony\Component\Finder\Finder), Object(OpenApi\Analysis), true)
#8 /app/vendor/light/yii2-swagger/src/SwaggerApiAction.php(156): OpenApi\Generator::scan(Object(Symfony\Component\Finder\Finder), Array)
#9 /app/vendor/light/yii2-swagger/src/SwaggerApiAction.php(110): light\swagger\SwaggerApiAction->getSwagger()
#10 [internal function]: light\swagger\SwaggerApiAction->run()
#11 /app/vendor/yiisoft/yii2/base/Action.php(93): call_user_func_array(Array, Array)
#12 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\Action->runWithParams(Array)
#13 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('api', Array)
#14 /app/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('default/api', Array)
#15 /app/vendor/yiisoft/yii2/base/Application.php(384): yii\web\Application->handleRequest(Object(yii\web\Request))
#16 /app/api/index.php(16): yii\base\Application->run()
#17 {main}

Fail to open swagger app:
PHP version: 7.4.30
Yii version 2.0.45
light/yii2-swagger v3.0.3

image

@wa1kb0y
Copy link

wa1kb0y commented Jun 29, 2022

Similar issue after update up to 3.0.3.
Downgrade to 3.0.2 helps.
composer require light/yii2-swagger 3.0.2 -W

@Krakozaber
Copy link
Contributor

Krakozaber commented Jul 4, 2022

Check out the migration process to version 4.
https://zircote.github.io/swagger-php/guide/migrating-to-v4.html

Annotations now must be associated with a structural element (class, trait, interface), a method, property or const.

@lichunqiang perhaps the package version should have been upgraded to 4.0.0. #30 zircote/swagger-php v4 is fine and much more convenient, but it breaks backward compatibility :-(

@zebraf1
Copy link

zebraf1 commented Oct 2, 2024

I ran into a similar issue and it turned out to be a naming issue for the underlying class.

The file name and the class name inside must match, otherwise it would return "Skipping unknown namespace/to/class".

Basicly class_exists('Namespace/To/Class') will be false if the class isn't autoloaded. This is what ReflectionAnalyzer->analyzeFqdn() checks.

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

4 participants