After reading these 2 posts here on Stackoverflow: How to Solved ErrorException : Required @OA\PathItem() not found Can't generate API documentation in l5-swagger
I still get an error Required @OA\PathItem() not found after running php artisan l5-swagger:generate.
This is my Controller.php part:
/**
* @OA\Info(
* title="My First API Documentation",
* version="0.1",
* @OA\Contact(
* email="[email protected]"
* ),
* ),
* @OA\Server(
* description="Learning env",
* url="https://foo.localhost:8000/api/"
* ),
*/
class Controller extends BaseController
{
and this is my ProfileController part:
/**
* @OA\Get(
* path="/profiles",
* @OA\Response(
* response=200,
* description="Successful operation",
* ),
* @OA\PathItem (
* ),
* )
*/
function index()
{
return new ProfileCollection(Profile::with('user')->paginate());
}
What am I overlooking here? If anyone can explain and help that would be great :)
EDIT - SOLUTION
The problem occured because I am using a laravel modules package and I had to change a bit of code in the l5-swagger.php config file:
'annotations' => [
base_path('Modules/Api/Http'), <-- changed the base path to the correct module
],
I then copied the main Controller.php from App/Http/Controllers to the same Module to also get rid of the occuring @OA\Info() not found error after that.

darkaonline/l5-swagger, Ensure your application has the necessary Swagger annotations throughout the controllers and models and the run this command againcomposer updateand then try againphp artisan l5-swagger:generate