Swagger-php: Multiple @OA\Response() with the same response

Created on 15 Jul 2021  路  7Comments  路  Source: zircote/swagger-php

Multiple @OA\Response() with the same response="404":
\app\modules\api\controllers\CartController->actionUpdateTransfer() in /app/source/modules/pages/controllers/../../api/controllers/CartController.php on line 295
/app/source/modules/pages/controllers/../../api/actions/domain/DomainInfoAction.php on line 21

I look to other issues - cases is correct, add vardump near exeption and looks like incorrect context merge, because

screencapture-dev-local-namesilo-net-8080-swagger-api-json-2021-07-15-18_29_08

items with different contexts in same array
maybe some incorrect context calculation

All 7 comments

should be only first two
class DomainInfoAction and @OA\Get(path="/domain/api/info/{domain}"
but in same array
InfoAction and @OA\Get(path="/ssl-manager/api/{sslId}"
InstallAction and @OA\Post(path="/ssl-manager/api/install"
and added new \app\modules\api\controllers\CartController->actionUpdateTransfer() with @OA\Post(path="/cart/api/item/{id}/transfer"

Does DomainInfoAction extend InfoAction? Any chance of extracting enough annotations and (empty) classes to reproduce this?
Also, is this using the latest version or dev-master?

No, all classes is yii actions and yii controllers
Yes, latest release and dev-master - same error

Try to clean all project

bug.zip

Clean project
yii2 app, source/web/ - root, error in page /swagger/api-json

if remove in CartController.php @OA\Response(response=404, description="Item not found") all work fine

Well, that was a good one!

its the JsonContent line in the 200 response! There is an additional closing backet at the end..

     *   @OA\Response(response=200, description="Item updated successfully",
     *     @OA\JsonContent(type="object", ref="#/components/schemas/ObjectResponseDto"))
     *   ),

What happens is that the doctrine parser accepts it so the Post is finished after that and the 404 becomes a top level annotation 馃し

Thanks
sorry

https://github.com/doctrine/annotations/issues/420
added issue - they ignore bracket balanse

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DerManoMann picture DerManoMann  路  3Comments

phansys picture phansys  路  5Comments

jfiala picture jfiala  路  5Comments

Dalabad picture Dalabad  路  4Comments

justicenode picture justicenode  路  4Comments