先看这段代码:
@api.doc('GetList')
@api.param('changenumber', '变更单号')
@api.param('mindate', '起始日期')
@api.param('maxdate', '截至日期')
@api.response(ARGUMENTS_ERROR, 'need at least one argument')
@api.response(HTTP_NOT_FOUND, 'no record found')
@api.response(HTTP_GET_SUCCESS, 'query success')
@api.marshal_with(list_model)
def get(self):
pass
有没有发现什么异常?
咋一看,该有的都有,很全面呀,可是在swagger页面上:
后来对比了下官方DEMO,发现doc和marshal_with()或者expect()要放到一起写才行:
@api.doc('Get_Plan_List')
@api.marshal_with(record_list_model)
@api.param('changenumber', '变更单号')
@api.param('mindate', '起始日期')
@api.param('maxdate', '截至日期')
@api.response(ARGUMENTS_ERROR, 'need at least one argument')
@api.response(HTTP_NOT_FOUND, 'no record found')
@api.response(HTTP_GET_SUCCESS, 'query success')
def get(self):
pass
没啥好说,拧耳朵,按规矩办!