Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/swagger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ You can document a class or a method:
def post(self, id):
api.abort(403)

If you want a finer control, nested dicts could also be used:

.. code-block:: python

@api.route('/my-resource/<id>', endpoint='my-resource')
@api.doc(params={'id': {'description': 'An ID', 'required': 'true', 'default': ''}})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers, this helped me. However, while the string value "true" is evaluated to True, so is the string value "false". "required" needs to be a boolean.

Suggested change
@api.doc(params={'id': {'description': 'An ID', 'required': 'true', 'default': ''}})
@api.doc(params={'id': {'description': 'An ID', 'required': False, 'default': ''}})

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated.

class MyResource(Resource):
def get(self, id):
return {}


Automatically documented models
-------------------------------
Expand Down