2

I have a REST controller using the ParamConverter Symfony's service, using nelmio api doc annotation :

<?php

    /**
     * @param Plan $plan The plan id
     *
     * @ApiDoc(
     *  description="Returns plan details",
     *  output={
     *      "class"="AppBundle\Entity\Plan",
     *      "groups"={"details"}
     *  }
     * )
     *
     * @return Response
     */
    public function getAction(Plan $plan) // [...]

The api doc is correctly rendered but show a Plan requirement type:

enter image description here

I want to rename my parameter to plan_id and specify the integer type.

So I tried with requirements options, like this:

<?php

    /**
     * @param Plan $plan The plan id
     *
     * @ApiDoc(
     *  description="Returns plan details",
     *  requirements={
     *      {
     *          "name"="plan_id",
     *          "dataType"="integer",
     *          "requirement"="\d+",
     *          "description"="The plan's id"
     *      }
     *  },
     *  output={
     *      "class"="AppBundle\Entity\Plan",
     *      "groups"={"details"}
     *  }
     * )
     *
     * @return Response
     */
    public function getAction(Plan $plan) // [...]

But now it's showing me both parameters:

enter image description here

What is the best and proper method to override or remove @param tag from api doc? Without remove it form comment doc of course...

Thanks for your help!

cezar
  • 11,616
  • 6
  • 48
  • 84
Soullivaneuh
  • 3,553
  • 3
  • 37
  • 71

0 Answers0