我有以下路径:
path('path/<int:object_id>',
function,
name='function'),
事实上,drf_yasg正在为生成文档
object_id
就好像它是一个字符串:
所以我决定在
swagger_auto_schema
室内装修设计师
@swagger_auto_schema(
method='PATCH',
manual_parameters=[
openapi.Parameter('object_id', openapi.IN_PATH, required=True, description='Object ID'),
# query parameters
],
# operation_description, responses, etc
)
@api_view(['PATCH'])
@permission_classes([IsAuthenticated])
def function(request, object_id)
然而,通过这样做,drf_yasg会引发错误
either schema or type are required for Parameter object (not both)!
,并且我无法修复此问题,除非我删除
对象id
装饰器的路径参数
无论如何,我感兴趣的是能够在decorator中显式地描述我的路径参数,而不是让drf_yasg自己做这件事
我该怎么解决这个问题?