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.
Check your Nelmio version.
Last version is 4.*, but in Symfony "current" page, we can read instructions for "Nelmio 3.x"
Read instructions here : https://symfony.com/doc/4.x/bundles/NelmioApiDocBundle/index.html