티스토리 뷰

공부

[Python] flask swagger parameter model

승가비 2020. 6. 26. 02:30
728x90
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

import werkzeug
from flask import request
from flask_restplus import Namespace, Resource, reqparse

from modules.line import *
from utils.common_utils import CommonUtils

api = Namespace('line', description='line')
parser = reqparse.RequestParser()
parser.add_argument('message',
                    type=str,
                    help="message",
                    default='test',
                    required=True)
parser.add_argument('token',
                    type=str,
                    help="token",
                    default=TOKEN_LINE)
parser.add_argument('image',
                    type=werkzeug.datastructures.FileStorage,
                    help="image",
                    default=None)

 

https://flask-restplus.readthedocs.io/en/0.7.0/documenting.html

 

Documenting your API with Swagger — Flask-RESTPlus 0.7.0 documentation

Each resource will be documented as a Swagger path. Each resource method (get, post, put, delete, path, options, head) will be documented as a swagger operation. You can specify the Swagger unique operationId with the id documentation. In the previous exam

flask-restplus.readthedocs.io

https://flask-restplus.readthedocs.io/en/stable/parsing.html

 

Request Parsing — Flask-RESTPlus 0.13.0 documentation

Request Parsing Warning The whole request parser part of Flask-RESTPlus is slated for removal and will be replaced by documentation on how to integrate with other packages that do the input/output stuff better (such as marshmallow). This means that it will

flask-restplus.readthedocs.io

https://github.com/noirbizarre/flask-restplus/issues/772

 

how to display query parameters in swagger documentation · Issue #772 · noirbizarre/flask-restplus

I am wondering if it is available to display query parameter in swagger documentation. Here is what I implemented on my project. To obtain query parameters, ReqParser - specifically add_argument me...

github.com

 

728x90
댓글