Sebastian
Sebastian

Reputation: 250

Why does a custom route appears twice in Nelmio API Doc?

I've tried defining a custom route name for one of my APIs and since then, the API Doc displays that route twice. Any ideas why?

Here's the definition of my API:

/**
 * @ApiDoc(
 *   description = "Sends the support email to the HelpDesk address",
 *   statusCodes = {
 *     204 = "Returned when successful",
 *     400 = "Returned when the parameters are incorrect",
 *     401 = "Returned when the token is invalid",
 *     500 = "Returned when there's an internal server error"
 *   },
 *   input="AppBundle\Form\Type\SupportEmailType"
 * )
 * @Post("/support-requests")
 * @Rest\View ()
 */
public function postSupportAction(Request $request)

and here's how the route shows up in my doc: enter image description here

And this is my routing.yml file:

# app/config/routing.yml
app:
    resource: "@AppBundle/Controller/"
    type:     annotation
NelmioApiDocBundle:
   resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
   prefix:   /api/doc
user:
    type:     rest
    resource: AppBundle\Controller\UserController

Upvotes: 1

Views: 2081

Answers (1)

Alexandru Cosoi
Alexandru Cosoi

Reputation: 1000

From the looks of it the only thing that comes to mind as having the potential to do this is the first part of your routing.yml

try removing this from your routing.yml

app:
    resource: "@AppBundle/Controller/"
    type:     annotation

I think this code, and the separated definition of the user route makes nelmio see the route twice. I had a similar problem some time ago and I think this was the reason. Sorry for the amount of questions I had to ask but i needed to see the full picture.

Hope this helps,

Alexandru Cosoi

Upvotes: 2

Related Questions