予。我是使用Django REST Swagger获取API文档的新手。我试图了解如何编辑a)'实施注释'和b)参数描述。下图 -
https://github.com/PeculiarVentures/webcrypto-liner
这是我对'Crash'模型的看法。
class CrashViewSet(viewsets.ModelViewSet):
"""
retrieve: Get a single Crash instance
list: Get a list of all Crashes
"""
queryset = Crash.objects.all()
serializer_class = CrashSerializer
filter_backends = (SearchFilter,DjangoFilterBackend,OrderingFilter,)
search_fields = ('crash_id','crash_hr_short_desc','urb_area_short_nm','fc_short_desc',
'hwy_compnt_short_desc','mlge_typ_short_desc', 'specl_jrsdct_short_desc',
'jrsdct_grp_long_desc','st_full_nm','isect_st_full_nm','rd_char_short_desc',
'isect_typ_short_desc','crash_typ_short_desc','collis_typ_short_desc',
'rd_cntl_med_desc','wthr_cond_short_desc','rd_surf_short_desc','lgt_cond_short_desc',
'traf_cntl_device_short_desc','invstg_agy_short_desc','crash_cause_1_short_desc',
'crash_cause_2_short_desc','crash_cause_3_short_desc','pop_rng_med_desc','rd_cntl_med_desc')
filter_fields = ('ser_no','cnty_id','alchl_invlv_flg','crash_day_no','crash_mo_no','crash_yr_no','crash_hr_no',
'schl_zone_ind','wrk_zone_ind','alchl_invlv_flg','drug_invlv_flg','crash_speed_invlv_flg',
'crash_hit_run_flg',)
ordering_fields = '__all__'
我对DocString进行了一些编辑,但不太了解如何继续,以便更全面地描述端点及其字段。我尝试了,但我没有就如何格式化DOCSTRING给出任何指示。最好的方法是什么?
II。另一个小问题是我想摆脱'Django Login'按钮,因为这是公共API。我该怎么做呢? the Django REST Swagger tutorial
III。有哪些API文档的最佳实践?