I want to create a REST API using flask. I also would like to document the api using swagger 2.0. This is the reason why I chose flasgger to create a webpage for the documentation. Right now the web page is rendered but the parameters for the request are not displayed, although I did add them in the yaml file. I added the result of the webpage as image. Part of the content of the yaml file can be seen in the other image. In the main file I configured the Swagger object like in the image below. I would be really thankful, if you could help find the reason why, I am not able to see those parameters.
Asked
Active
Viewed 611 times
1 Answers
0
you need to wrap your view with the decorator @swag_from("your_yaml_file_here")
for example:
from flasgger import swag_from
@app.route('/colors/<palette>/')
@swag_from('colors.yml')
def colors(palette):
....
If you do not want to use the decorator you can use the docstring file:
shortcut.
@app.route('/colors/<palette>/')
def colors(palette):
"""
file: colors.yml
"""
...
Refer the link https://github.com/flasgger/flasgger to know more.

Akhil S
- 955
- 11
- 16