laravel-openapi icon indicating copy to clipboard operation
laravel-openapi copied to clipboard

Guidance Needed: How to Utilize Vyuldashev\LaravelOpenApi After Setup?

Open wgtgithub opened this issue 1 year ago • 1 comments

I executed the command as instructed, however, I'm uncertain if it resolved the issue. Moreover, I lack the documentation on utilizing the OpenAPI tag items. Could you provide guidance on their usage?

php artisan openapi:generate

   Error 

  Unknown named parameter $summary

  at app/Http/Controllers/MyController.php:12
      8▕ 
      9▕ //#[OpenApi\PathItem]
     10▕ class MyController extends Controller
     11▕ {
  ➜  12▕     #[OpenApi\Operation(tags: ['Items'], summary: 'List all items')]
     13▕     //#[OpenApi\Operation(tags: ['Items'])]
     14▕     public function index()
     15▕     {
     16▕         $items = Item::all();

      +1 vendor frames 

  2   [internal]:0
      Vyuldashev\LaravelOpenApi\RouteInformation::Vyuldashev\LaravelOpenApi\{closure}()
      +6 vendor frames 

  9   [internal]:0
      Vyuldashev\LaravelOpenApi\Builders\PathsBuilder::Vyuldashev\LaravelOpenApi\Builders\{closure}()`

wgtgithub avatar Apr 30 '24 08:04 wgtgithub

The summary and description for Operation will reflect the comments in DocBlock.

https://vyuldashev.github.io/laravel-openapi/paths/operations.html Operations

Unfortunately, a complete list of parameters to specify for the attribute does not seem to be provided. (I also had a hard time at first)

For easy inspection, you can use the hint display in your editor or IDE.

For example, in this screenshot, when you hover over an Operation in VSCode, a list of available parameter names is displayed:

VSCode-Display

Many parameter names are the same as OAS property names, so this display will help you understand to some extent. (It seems that summary cannot be specified here)

KentarouTakeda avatar May 01 '24 04:05 KentarouTakeda