【发布时间】:2017-11-23 10:52:25
【问题描述】:
我正在寻找一种将多种响应类型添加到通过 NelmioAPiDoc 实现的 swagger-ui 的方法
我希望图像/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"}
* )
*/
【问题讨论】:
标签: symfony swagger-ui nelmioapidocbundle