zircote / swagger-php

A php swagger annotation and parsing library
http://zircote.github.io/swagger-php/
Apache License 2.0
5.1k stars 933 forks source link

Example: Is it possible to merge OA\Components ? #1552

Open ahmadfadlydziljalal opened 8 months ago

ahmadfadlydziljalal commented 8 months ago

Basically, this is not an issue. Just ask, is it possible to merge OA\Components ?

The case is, I have a lot of controllers. For maintainability, at least for myself, I separate the controllers like this:

image

But, I got an error, and I know, what exactly those error.

PHP User Warning 'yii\base\ErrorException' with message 'Only one @OA\Components() allowed for @OA\OpenApi() multiple found in:
    Using: /var/www/html/modules/v1/controllers/AgamaController.php on line 226
  Skipped: /var/www/html/modules/v1/controllers/MeController.php on line 128'

in /var/www/html/vendor/zircote/swagger-php/src/Loggers/DefaultLogger.php:31

It so readable in each route/action.

image

Any suggestion is so appreciated.

DerManoMann commented 8 months ago

Hmm, I guess we could just merge components if more than one is found. Components is a container so that would make sense I suppose.