flask-restful-swagger
flask-restful-swagger copied to clipboard
spec.html only showing first blueprint registered
Trying to figure out what I have done wrong. I am registering 3 different blueprints into my app, but the spec.html page only ever shows the operations for whichever one I registered first. So in my example snippets here, only the operations from blueprint_1 end up in the spec.
blueprint_1.py
blueprint = Blueprint('blueprint_1', __name__)
api = swagger.docs(Api(blueprint), apiVersion='1.0', api_spec_url="/v1.0/spec", description="API Documentation")
blueprint_2.py
blueprint = Blueprint('blueprint_2', __name__)
api = swagger.docs(Api(blueprint), apiVersion='1.0', api_spec_url="/v1.0/spec", description="API Documentation")
blueprint_3.py
blueprint = Blueprint('blueprint_3', __name__)
api = swagger.docs(Api(blueprint), apiVersion='1.0', api_spec_url="/v1.0/spec", description="API Documentation")
app.py
app.register_blueprint(blueprint_1.blueprint, url_prefix='/api')
app.register_blueprint(blueprint_2.blueprint, url_prefix='/api')
app.register_blueprint(blueprint_3.blueprint, url_prefix='/api')
hi @jonny166 flask seems to register only once a blueprint on a particular url prefix in the examples/blueprints.py file, url_prefix are different for each blueprint, and you put '/api' for each. that's could be the point that
@app.route('/docs')
def docs():
return redirect('/static/docs.html')
if __name__ == '__main__':
TodoItemWithResourceFields()
TodoItem(1, 2, '3')
app.register_blueprint(my_blueprint1, url_prefix='/api1')
app.register_blueprint(my_blueprint2, url_prefix='/api2')
So what is the proper way to get the entire app to render on a single spec.html page? On Feb 21, 2015 4:49 AM, "lounagen" [email protected] wrote:
hi @jonny166 https://github.com/jonny166 flask seems to register only once a blueprint on a particular url prefix in the examples/blueprints.py file, url_prefix are different for each blueprint, and you put '/api' for each. that's could be the point that
@app.route('/docs') def docs(): return redirect('/static/docs.html')
if name == 'main': TodoItemWithResourceFields() TodoItem(1, 2, '3') app.register_blueprint(my_blueprint1, url_prefix='/api1') app.register_blueprint(my_blueprint2, url_prefix='/api2')
— Reply to this email directly or view it on GitHub https://github.com/rantav/flask-restful-swagger/issues/74#issuecomment-75364453 .
I have the same issue. Does anyone know how to organize a moduled API service so api/spec.html
will be generated for all modules?
I also have the same problem. Any solution available now?
I would like to know the same ...
Just for your information, since I found this project I have also tried two others that I can recommend now since this one is kind of dead:
- flask-RESTplus (I have also implemented a nice "real-life example" on it)
- flask-apispec