Flask-Restx Swagger 文档问题

问题描述

我收到 AttributeError: module 'flask_restx.api' has no attribute 'doc' 当它在使用flask restx 时尝试为 API 添加额外的内容时。如何修复此错误。

api.py

from flask import Flask
from flask_restx import Api,Resource
from hello import Hello

app = Flask(__name__)
api = Api(app)

api.add_resource(Hello,'/hello')

if __name__ == '__main__':
    app.run(debug=True)

hello.py

from flask_restx import Resource,api


@api.doc(params={'id': 'An ID'})
class Hello(Resource):
    def get(self):
        return {
            'data': {
                'names': ['one','two','three']
            }
        }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)