[英]drf yasg how to add new options to response content type
I have defined some interfaces when using drf-swagger
, they need to specify accept parameters in order to return the content correctly.我在使用
drf-swagger
时定义了一些接口,它们需要指定接受参数才能正确返回内容。 For example, I will return a file for download.例如,我将返回一个文件以供下载。 Obviously, the
application/JSON
parameter cannot provide the correct format.显然,
application/JSON
参数无法提供正确的格式。 I want to be able to add new options to the response content type.
我希望能够为响应内容类型添加新选项。 There may already be a solution, but I didn't find it ~
可能已经有解决方案了,但是我没找到~
To add additional response content type you should take a look at DRF renderers .要添加其他响应内容类型,您应该查看DRF 渲染器。
drf-yasg
works on top of drf
, eg see get_produces()
code . drf-yasg
上的顶级作品drf
,如见get_produces()
代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.