Description
Ask a question
When using the @api.doc()
decorator, how can I provide an example request value?
Additional context
The documentation for @api.doc()
is rather incomplete at the moment but I've been able to piece together the following request decorator:
@api.doc(params={'someparam: {'description': 'A param description', 'in': 'query', 'type': 'string', 'required': 'true'}})
The above works as expected passing all of the information to swagger. However, the following does not pass the example value to Swagger:
@api.doc(params={'someparam: {'description': 'A param description', 'in': 'query', 'type': 'string', 'required': 'true', 'example': 'example_value'}})
Is there some way to pass this example value along that I'm missing?
Somewhat related, though not the subject of the question; I've also noticed the following works to add a description to a route:
@api.doc(description='Some text describing the route')
However, the following does not work:
@api.doc(summary='Some text describing the route')
I had initially assumed these decorators were simply being parsed and passed directly into Swagger but that does not appear to be the case. I'm also open to other better ways to achieve this if any exist as the above decorators have grown quite large.