如何隐藏Django REST的响应类?

时间:2022-03-21 02:41:25

I am trying to hide the Response Class (Model and Model Schema) from API docs I am writing via Django REST Swagger.

我试图从我通过Django REST Swagger编写的API文档中隐藏响应类(模型和模型模式)。

I thought maybe I could set @APIModelProperty(hidden=true) - but no luck. I can't seem to find anything in the Django REST Swagger docs either.

我想也许我可以设置@APIModelProperty(hidden=true)——但是运气不好。我似乎在《被解放的姜戈》中也找不到什么东西。

Any ideas? Thanks.

什么好主意吗?谢谢。

1 个解决方案

#1


1  

You can use the YAML Docstring: http://django-rest-swagger.readthedocs.io/en/latest/yaml.html

您可以使用YAML Docstring: http://django-rest-swagger.readthedocs.io/en/latest/yaml.html。

Use the parameter omit_serializer:

使用参数omit_serializer:

"""
Method description here
---
omit_serializer: true
"""

#1


1  

You can use the YAML Docstring: http://django-rest-swagger.readthedocs.io/en/latest/yaml.html

您可以使用YAML Docstring: http://django-rest-swagger.readthedocs.io/en/latest/yaml.html。

Use the parameter omit_serializer:

使用参数omit_serializer:

"""
Method description here
---
omit_serializer: true
"""