I have a problem with displaying my endpoints in the nelmio api interface. this is my config:
nelmio_api_doc.yaml
nelmio_api_doc:
areas:
path_patterns: # an array of regexps
- ^/api(?!/doc$)
host_patterns:
- ^api\.
routes.yaml
controllers:
resource: ../src/Application/Controller/
type: annotation
app.swagger_ui:
path: /api/doc
methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger_ui }
app.swagger:
path: /api/doc.json
methods: GET
defaults: { _controller: nelmio_api_doc.controller.swagger }
kernel:
resource: ../src/Kernel.php
type: annotation
Controller:
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\OpenApi\Annotations\Tag;
class MyController
{
/**
* @Route("/api/jd", name="my_route", methods={"GET"})
* @Tag(name="example tag") <- invoke error
*/
public function myAction(): Response
{
return new Response(
'<html><body>Lucky number: '."wd".'</body></html>'
);
}
}
I read that in order for nelmio api to see endpiints, you need to add markings to routes such as tag and so on, but when it gives this type of marking, I get an error:
[Semantical Error] The annotation "@Nelmio\ApiDocBundle\Annotation\Tag" in method Application\Controller\MyController::myAction() was never imported. Did you maybe forget to add a "use" statement for this annotation? in /Users/michal/Desktop/BitHub/src/AuthHub/config/../src/Application/Controller/ (which is being imported from "/Users/michal/Desktop/BitHub/src/AuthHub/config/routes.yaml "). Make sure there is a loader supporting the "annotation" type.
anyone know how i can achieve my goal? thanks in advance