Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document api.doc parameter description via dict #495

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alexanderustinov
Copy link

Have lost few hours before stumbled upon solution (#139) for describing parameters inside api.doc decorator via dict. Wanted to to spare the time for the next one searching.

doc/swagger.rst Outdated
.. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants