0
Hello!
First, I set my file web.php
in this way:
/**
* @OA\Info(title="My First API", version="0.1")
*/
/**
* @OA\Get(
* path="/api/resource.json",
* @OA\Response(response="200", description="An example resource")
* )
*/
$router->get('/', function () use ($router) {
return $router->app->version();
});
I tried using the php code example present in Swagger-PHP documentation but I couldn’t understand where I should add this code and whether it works with Lumen.
<?php
require("vendor/autoload.php");
$openapi = \OpenApi\scan('/path/to/project');
header('Content-Type: application/x-yaml');
echo $openapi->toYaml();
Then I tried using the CLI present in the package, so I typed the command ./vendor/bin/openapi app
and he returned that:
Required @OA\Info() not found
Required @OA\PathItem() not found
openapi: 3.0.0
How do I set up and correctly use Swagger-PHP in a Lumen 8 project? And What is the reason for the errors I described above?