lzjun567 / flask-siwadoc

flask-siwadoc is a flask data validator and openapi document generator automaticly
MIT License
53 stars 14 forks source link

接口比较多,没办法创建两个接口文档 #13

Open FiveMeter opened 1 year ago

FiveMeter commented 1 year ago

AssertionError: A name collision occurred between blueprints <flask.blueprints.Blueprint object at 0x7f9ea0a14cc0> and <flask.blueprints.Blueprint object at 0x7f9ea0a149b0>. Both share the same name "siwadoc". Blueprints that are created on the fly need unique names.

Shone1214 commented 1 year ago

新建一个文件context用于存储,用的时候再取出来

def create_app(settings):
    app = Flask(__name__)
    context['app'] = app
    context['siwa'] = SiwaDoc(app, doc_url='/docs', openapi_url='/openapi.json',  title="test", description="test")
from ..context import context

siwa = context.get('siwa')

@siwa.doc()
# 定义接口