flask-selfdoc icon indicating copy to clipboard operation
flask-selfdoc copied to clipboard

A way of adding all endpoint automatically.

Open jwg4 opened this issue 7 years ago • 1 comments

jwg4 avatar May 22 '18 16:05 jwg4

A working solution for me was:

from flask_selfdoc import Autodoc
from my_app import app


auto = Autodoc(app)

for rule in app.url_map.iter_rules():
    auto.doc()(app.view_functions[rule.endpoint])

I think it's not too hacky and could maybe be temporarily part of the documentation until there's a better way to do it. Especially because the doc says:

by default, Flask-Selfdoc will only document the routes explicitly decorated with doc

but doesn't explain what to do if we want to override this default behaviour.

ValentinFrancois avatar Apr 29 '22 10:04 ValentinFrancois