swagger-php: Warning Skipping unknown & Required @OA\Info() not found in zircote/swagger-php/src/Loggers/DefaultLogger.php
- My Own PHP Framework
- PHP Version : 8.2.4
- OS: Mac and Linux
I was previously using an older version of Swagger, which was functioning well. Recently, I upgraded to the latest version, for both:
composer require zircote/swagger-php;
composer require doctrine/annotations;
and
composer update zircote/swagger-php;
composer update doctrine/annotations;
The JSON file was successfully loaded and is displaying correctly in the Swagger UI, However, I’m encountering an issue that I’ve been unable to resolve despite trying multiple solutions. Before reaching out, I attempted various troubleshooting steps, but none were successful. Getting now warning displayed below
Warning: Skipping unknown \new_form in /Users/mike/Sites/localhost/vendor/zircote/swagger-php/src/Loggers/DefaultLogger.php on line 23 Warning: Required @OA\PathItem() not found in /Users/mike/Sites/localhost/vendor/zircote/swagger-php/src/Loggers/DefaultLogger.php on line 23 Warning: Required @OA\Info() not found in /Users/mike/Sites/localhost/vendor/zircote/swagger-php/src/Loggers/DefaultLogger.php on line 23 { “openapi”: “3.0.0” }
Could you kindly let me know if there are any specific steps or configurations I should follow to ensure everything works seamlessly after the upgrade? taking into consideration that the json file was loaded and showing in the swagger ui well
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19
Ok, first of all there are a couple minor issues with your annotations:
,, not;PathItemrequires apathpropertySo, here is the corrected file (
other.php) I usedSecondly, you have two choices to generate the spec from the file. For both, the key is that your code/annotations need to be either autoloaded or manually be loaded before processing. Typically when using
composeryour code would be autoloaded automatically (if configured properly); for single file experiments or small apps you are responsible for that yourself.openapicommand line tool (assuming swagger-php is installed via composer) andother.phpis inside asrcfolder. The-boption means thatother.phpisincludedbefore processing starts…other.phpisrequire’d before processing.