OpenQuizz
Une application de gestion des contenus pédagogiques
FlaskApiSpec Class Reference

Public Member Functions

def __init__ (self, app=None, document_options=True)
 
def init_app (self, app)
 
def add_swagger_routes (self)
 
def swagger_json (self)
 
def swagger_ui (self)
 
def register_existing_resources (self)
 
def register (self, target, endpoint=None, blueprint=None, resource_class_args=None, resource_class_kwargs=None)
 

Data Fields

 app
 
 view_converter
 
 resource_converter
 
 spec
 
 document_options
 

Detailed Description

Flask-apispec extension.

Usage:

.. code-block:: python

    app = Flask(__name__)
    app.config.update({
        'APISPEC_SPEC': APISpec(
            title='pets',
            version='v1',
            openapi_version='2.0',
            plugins=[MarshmallowPlugin()],
        ),
        'APISPEC_SWAGGER_URL': '/swagger/',
    })
    docs = FlaskApiSpec(app)

    @app.route('/pet/<pet_id>')
    def get_pet(pet_id):
        return Pet.query.filter(Pet.id == pet_id).one()

    docs.register(get_pet)

:param Flask app: App associated with API documentation
:param APISpec spec: apispec specification associated with API documentation
:param bool document_options: Whether or not to include
    OPTIONS requests in the specification

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  app = None,
  document_options = True 
)

Member Function Documentation

◆ add_swagger_routes()

def add_swagger_routes (   self)

◆ init_app()

def init_app (   self,
  app 
)

◆ register()

def register (   self,
  target,
  endpoint = None,
  blueprint = None,
  resource_class_args = None,
  resource_class_kwargs = None 
)
Register a view.

:param target: view function or view class.
:param endpoint: (optional) endpoint name.
:param blueprint: (optional) blueprint name.
:param tuple resource_class_args: (optional) args to be forwarded to the
    view class constructor.
:param dict resource_class_kwargs: (optional) kwargs to be forwarded to
    the view class constructor.

◆ register_existing_resources()

def register_existing_resources (   self)

◆ swagger_json()

def swagger_json (   self)

◆ swagger_ui()

def swagger_ui (   self)

Field Documentation

◆ app

app

◆ document_options

document_options

◆ resource_converter

resource_converter

◆ spec

spec

◆ view_converter

view_converter

The documentation for this class was generated from the following file: