Skip to content

Commit 4aa2975

Browse files
committed
Add something for each documented endpoint.
1 parent 7b9ef7f commit 4aa2975

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

flask_selfdoc/autodoc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,16 @@ def html(self, groups='all', template=None, **context):
196196
with current_app.app_context():
197197
return render_template_string(content, **context)
198198

199-
def json(self, groups='all', **context):
199+
def json(self, groups='all'):
200200
"""Return a json object with documentation for all the routes specified
201201
by the doc() method.
202202
203203
By specifiying the groups argument, only routes belonging to those groups
204204
will be returned.
205205
"""
206-
data = {}
206+
autodoc = self.generate(groups=groups)
207+
data = {
208+
'endpoints':
209+
[ "doc" for doc in autodoc ]
210+
}
207211
return jsonify(data)

0 commit comments

Comments
 (0)