-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Required @OA\Info() not found #443
Comments
Add in your base Controller
|
I have docs and Controllers separated. I do have Info set up which was working perfectly fine until now for some reason |
It's happing with me also. |
That's why i posted it. I was wondering if anyone was having same issue, thanks i'll try downgrading |
Downgrading to 8.1 Fixed the issue |
Same here.. I would reopen the issue, this is a migration issue. |
Thanks for the response, I accidentally closed it |
Same here, thanks for reopening the issue. This is related to #436. I understand the problem is in the upgrade to https://github.com/zircote/swagger-php 4.x |
Yes, this is true, swagger-php 4.* requires to have each annotation as a class or method phpDoc. Example: https://github.com/DarkaOnLine/L5-Swagger/blob/master/tests/storage/annotations/OpenApi/L5SwaggerAnnotationsExampleInfo.php |
I'm don't use annotation on my base code, I have different PHP files just for this, and I'm still getting this issue. Should I put OAInfo in each file? |
Please read swagger-php migration docs to v4
|
Hi, as I said before:
|
@Messhias this is fine if you are not using with code files. But still requirement for swagger-php:4 is that you must associate annotation with either a class/trait/interface, method or property. So in swagger-php:3 we had this: https://github.com/DarkaOnLine/L5-Swagger/blob/8.1.0/tests/storage/annotations/OpenApi/Anotations.php But with swagger-php:4 - you must do like this: https://github.com/DarkaOnLine/L5-Swagger/tree/8.3.0/tests/storage/annotations/OpenApi So if you do not want to redo your annotation you can fall back to swagger-php:3 by requesting it in your |
@Messhias I`ve just solved this issue:
so just dummy classes :D |
I don't use swagger in my classes, it's for API software documentation. I have a folder called documentation and point the swagger to there and wrote down only PHP comments. Example:
|
I did the same.
|
I have some issue @DarkaOnLine Here my composer.json {
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^8.0.2",
"darkaonline/l5-swagger": "^8.3",
"fruitcake/laravel-cors": "^2.0.5",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.0",
"laravel/sanctum": "^2.14",
"laravel/tinker": "^2.7"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
"phpunit/phpunit": "^9.5.10",
"spatie/laravel-ignition": "^1.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
|
Have you checked this comment: #443 (comment) and changes for swagger-php:4 |
I don't get this comment, there's no solution at all for my case and even for his case. So, there are a lot of files and this is not suggestive for a "solution". But I tried to go deeper to try to understand the solution behind it. And one of the examples of files I found something like this:
So what's the conclusion I found in your comment:
So as I told you before, and I don't have annotations for documentation in code files (don't get me wrong, but attention to this because I didn't find a relation for my case). So I did that (and this is my actual files): 1 - index.php
2 - A documentation page example (an auth request):
On version 3+ works fine in 8, if we update to 4 stop working (even in L8 or 9, at least on my case), and I tried to do it in the fresh installation, 4+ broken. Here screenshots working normally the version 3+ in the current laravel framework version (8+): So I believe might be I expressed myself about the issue in the wrong way, but I believe now we have all the information. So, sorry about the confusion. But I hope with this more detailed explanation you can track down the issue, and again, would be nice to you to create contribution conduct to everything try to fork the package and help you maintain it. Don't get me wrong, it seems you're maintaining it alone and for the volume of downloads and users would be nice for you to have some help. |
So this is fine as I told you. You just need to provide dummy class names and method names. For example, your <?php
namespace My/Name/Space;
/**
* @OA\Server(
* url=API_HOST,
* description=API_DESCRIPTION
* ),
* @OA\Info(
* title="API DOCUMENTATION",
* version="0.5",
* description="Standard documentation for third companies’ use. In this API all the necessary endpoints to be used by third-party providers for the set-up, management of new contributions, and retrieval of all necessary information are shown. This API is being continuously improved. Some endpoints can be updated and reviewed on an ongoing basis. Please check the latest version of the documentation for the most updated up-to-date information.",
* )
*/
class MySwaggerDocsInfoDummyClassName {}
You are always welcome to help end contribute, suggest better ways how to do that, help people by answering questions, dig deeper into how code works, etc. Complaining is the easiest path, try to take some actions. I would really appreciate any help ... |
I've fixed it by downgrading to version 8.1 with all his dependencies using the command |
Edit : apply #443 (comment) and it's ok with 8.3 Same problem Configuration :
and a php file for general documentation
|
I had similar problem. My installation: laravel 8, l5-swagger: 8.*. In the main controller, I put in the following:
Following this example did the job for me. As per the example, we need to wrap @OA\Info with @OA\OpenApi first. |
@gagansday tnx.It works for me |
Thanks @honorezemagho |
It works for me Error: Required @OA\Info() not found Laravel version: 8.75 |
Just in case anyone finds this in the future and still is running into this issue, I found out I had |
How can we downgrade version ? |
If anyone is still having this issue, I'm using |
Hello guys! I got same issue, but in my case in base Controller there was bunch of separated PHP DocBlocks, like:
which was working fine in previous versions, but failed with Swagger ^8.5 (+Laravel 10.13.5) When I merged all PHP DocBlocks into single one block the problem was solved. Hopefully it will help! Thank you for your attention! :-) |
Hi there, I am facing the same issue with laravel 9.19 and php8.1. I was facing the same issue after i have change the annotation path to my custom api directory. |
Hello there, I have put the than it needs when i am adding some path item than it again requires @DarkaOnLine can you please update this with example how to fix it? |
Damn, 8.5 causes error of |
By downgrading the version, the issue was solved for me. |
Just downgrading: |
I know this is an old topic, but the error was resolved for me by moving the @OA\Info documentation above the base Controller class definition (was inside it previously). |
Description:
Github actions throw [Required @OA\Info() not found] Error while it works perfectly fine on local. @OA\Info() is set of course and used to work on the server as well but it's not the case anymore. Any ideas why?
The text was updated successfully, but these errors were encountered: