Skip to content

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.

2 participants