The annotation "@Swagger\Annotations\Response" in method was never imported

Viewed 1746

I have a problem with fresh install of Swagger and FosRestBundle on Symfony 5 app. I have this error :

[Semantical Error] The annotation "@Swagger\Annotations\Response" in method ... was never imported. Did you maybe forget to add a "use" statement for this annotation? Make sure annotations are installed and enabled.

There is my code :

/**
 * @Route("/", name="api_ia", methods="GET")
 * @SWG\Response(
 *      response=200,
 *      description="Returns all informations based on image"
 *      @SWG\Schema(
 *          type="array"
 *      )
 * )
 * @SWG\Parameter(
 *      name="image"
 *      type="string"
 *      description="Photo of boiler label"
 * )
 * @SWG\Tag(name="IA")
 * @Security(name="Bearer")
 */

Has anyone ever had the problem? I did not modify my annotation file and I have imported Swagger\Annotations as SWG.

2 Answers

Thanks to Captain Nemo reply, with version 4.* of nelmio/api-doc-bundle it's @OA and not @SWG, with use OpenApi\Annotations as OA; !

Related