[英]django REST swagger function based api does not have input PARAMETERS
I am trying to do Django REST function based API with swagger following these instructions. 我正在按照这些说明大胆地做基于Django REST函数的API。
https://github.com/m-haziq/django-rest-swagger-docs https://github.com/m-haziq/django-rest-swagger-docs
However, I am unable to get any parameters shown in the function. 但是,我无法获得函数中显示的任何参数。 This is the screenshot of swagger NOT displaying any parameters. 这是不显示任何参数的屏幕截图。 https://imgur.com/a/fDITT https://imgur.com/a/n5CDU https://imgur.com/a/fDITT https://imgur.com/a/n5CDU
UPDATE:This is how I want to achieve with the parameters https://imgur.com/a/cLYNF 更新:这就是我要使用参数https://imgur.com/a/cLYNF实现的方式
Here is my API code, I want to have "name" parameters shown in swagger https://gitlab.com/firdausmah/railercom/blob/master/railercomapp/api.py 这是我的API代码,我想在招摇中显示“名称”参数https://gitlab.com/firdausmah/railercom/blob/master/railercomapp/api.py
@api_view(['POST'])
def test_post(request):
# ----- YAML below for Swagger -----
"""
description: This API deletes/uninstalls a device.
parameters:
- name: name
type: string
required: true
location: form
"""
name = request.POST.get('name')
return Response("Data Saved!", status=status.HTTP_201_CREATED)
This is the difference on my pip freeze library with the working example of django-rest-swagger-docs https://gist.github.com/anonymous/c5c328b9e4a6ff3f86676fe930440dd2 这是我的点子冻结库与django-rest-swagger-docs https://gist.github.com/anonymous/c5c328b9e4a6ff3f86676fe930440dd2的工作示例的区别
What is the problem, you can view the whole source code in gitlab. 有什么问题,您可以在gitlab中查看整个源代码。 Thanks. 谢谢。
I found this in readme 我在自述文件中找到了这个
*Input parameters for function based views do not appear:* You might be using
incompatible versions, try using `djangorestframework==3.5.3` and `django-rest-swagger==2.1.1`.
I updated to djangorestframework==3.5.3 and it works 我更新为djangorestframework == 3.5.3并且它有效
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.