Symfony2 Routing: import all controller annotations, but exclude one (duplicated routes in NelmioApiDoc)

Problem

When we define in routing.yml:

my_controllers:
    resource: "@MyBundle/Controller/"
    type:     annotation
    prefix:   /

and

my_api:
    resource:    'MyBundle\Controller\ApiController'
    type:        rest
    prefix:      /api
    name_prefix: my_api_
    options:
        expose: true

We get duplicate routes in NelmioApiDoc:

enter image description here

Question

How should we do this, so routes from ApiControllerwill not be duplicated?

  • exclude ApiControllerwildcard resources from import?
  • import all other controllers separately?
  • another solution?
+4
source share
1 answer

Nelmio ApiDoc, Symfony . , Symfony, API ( /api, ):

php app/console router:debug

, , - API (- @MyBundle/ControllerRest/) . my_api routing.yml API.

, , , ApiDoc .

+5

All Articles