我正在寻找一种向通过 NelmioAPiDoc 实现的 swagger-ui 添加多种响应类型的方法
我想选择 image/jpeg 作为响应类型 我有代码可以在控制器中工作以将主体设置为图像即使响应类型仍然是 application/json 但我的目标是如果 'application/json' 是selected 它以 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"}
* )
*/