Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple @OA\Response() with the same response #969

Closed
ivan1986 opened this issue Jul 15, 2021 · 7 comments
Closed

Multiple @OA\Response() with the same response #969

ivan1986 opened this issue Jul 15, 2021 · 7 comments

Comments

@ivan1986
Copy link

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

@ivan1986
Copy link
Author

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"

@DerManoMann
Copy link
Collaborator

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?

@ivan1986
Copy link
Author

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

Try to clean all project

@ivan1986
Copy link
Author

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

@DerManoMann
Copy link
Collaborator

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 🤷

@ivan1986
Copy link
Author

Thanks
sorry

@ivan1986
Copy link
Author

doctrine/annotations#420
added issue - they ignore bracket balanse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants