Swagger UI Symfony NelmioAPiDoc添加多个响应类型选项

Swagger UI Symfony NelmioAPiDoc添加多个响应类型选项,symfony,swagger-ui,nelmioapidocbundle,Symfony,Swagger Ui,Nelmioapidocbundle,我正在寻找一种方法,将多种响应类型添加到通过NelmioAPiDoc实现的swagger ui中 我希望选择image/jpeg作为响应类型我有代码在控制器中工作,以将主体设置为图像,即使响应类型仍然是application/json,但我的目标是如果选择了application/json,它将返回json格式的图像url,但如果选择了image/jpeg,它将图像返回到主体。非常感谢您的帮助 /** * @Security("is_granted('IS_AUTHENTICATED_FU

我正在寻找一种方法,将多种响应类型添加到通过NelmioAPiDoc实现的swagger ui中

我希望选择image/jpeg作为响应类型我有代码在控制器中工作,以将主体设置为图像,即使响应类型仍然是application/json,但我的目标是如果选择了application/json,它将返回json格式的图像url,但如果选择了image/jpeg,它将图像返回到主体。非常感谢您的帮助

 /**
 * @Security("is_granted('IS_AUTHENTICATED_FULLY')")
 *
 * @Route("/api/airs/renderframe", name="get_airs_frame", methods={"GET"})
 *
 * @SWG\Response(
 *     response=200,
 *     description="Returns json image url from paramaters",
 * )
 * @SWG\Parameter(
 *     name="imageHost",
 *     in="query",
 *     type="string",
 *     description="image host"
 * )
 * @SWG\Parameter(
 *     name="imagePath",
 *     in="query",
 *     type="string",
 *     description="image path"
 * )
 *
我也尝试过把它添加到我的课程的顶部,但仍然有一个下拉选项

 /**
 *  @SWG\Swagger(
 *               schemes={"http"},
 *               produces={"image/jpeg","application/json"},
 *               consumes={"application/json"}
 *  )
 */

通过将products{}放在@SWG\Get()中使其工作,但响应类型不在请求中,因为现在需要一个参数来确定如何访问该值

    /**
 * @Security("is_granted('IS_AUTHENTICATED_FULLY')")
 *
 * @Route("/api/airs/renderframe", name="get_airs_frame", methods={"GET"})
 *
 * @SWG\Get(
 *     produces={"application/xml", "application/json"},
 *     @SWG\Parameter(
 *         name="imageHost",
 *         in="query",
 *         type="string",
 *         description="image host"
 *     ),
 *     @SWG\Parameter(
 *         name="imagePath",
 *         in="query",
 *         type="string",
 *         description="image path"
 *     ),
 *     @SWG\Parameter(
 *         name="resource",
 *         in="query",
 *         type="string",
 *         default="renderframe/serveframe",
 *         description="Render picture in frame"
 *     ),
 *     @SWG\Parameter(
 *         name="maxSize",
 *         in="query",
 *         type="integer",
 *         description="image max Size"
 *     ),
 *     @SWG\Parameter(
 *         name="inchesWidth",
 *         in="query",
 *         type="integer",
 *         description="image inches WIdth"
 *     ),
 *     @SWG\Parameter(
 *         name="inchesHeight",
 *         in="query",
 *         type="integer",
 *         description="image inches Height"
 *     ),
 *     @SWG\Response(
 *         response=200,
 *         description="Returns json image url from paramaters",
 *     ),
 *     @SWG\Tag(name="Render picture in frame")
 * )

通过将products{}放在@SWG\Get()中使其工作,但响应类型不在请求中,因为现在需要一个参数来确定如何访问该值

    /**
 * @Security("is_granted('IS_AUTHENTICATED_FULLY')")
 *
 * @Route("/api/airs/renderframe", name="get_airs_frame", methods={"GET"})
 *
 * @SWG\Get(
 *     produces={"application/xml", "application/json"},
 *     @SWG\Parameter(
 *         name="imageHost",
 *         in="query",
 *         type="string",
 *         description="image host"
 *     ),
 *     @SWG\Parameter(
 *         name="imagePath",
 *         in="query",
 *         type="string",
 *         description="image path"
 *     ),
 *     @SWG\Parameter(
 *         name="resource",
 *         in="query",
 *         type="string",
 *         default="renderframe/serveframe",
 *         description="Render picture in frame"
 *     ),
 *     @SWG\Parameter(
 *         name="maxSize",
 *         in="query",
 *         type="integer",
 *         description="image max Size"
 *     ),
 *     @SWG\Parameter(
 *         name="inchesWidth",
 *         in="query",
 *         type="integer",
 *         description="image inches WIdth"
 *     ),
 *     @SWG\Parameter(
 *         name="inchesHeight",
 *         in="query",
 *         type="integer",
 *         description="image inches Height"
 *     ),
 *     @SWG\Response(
 *         response=200,
 *         description="Returns json image url from paramaters",
 *     ),
 *     @SWG\Tag(name="Render picture in frame")
 * )