OpenQuizz
Une application de gestion des contenus pédagogiques
flask_swagger Namespace Reference

Functions

def swagger (app, prefix=None, process_doc=_sanitize, from_file_keyword=None, template=None)
 

Detailed Description

What's the big idea?

An endpoint that traverses all restful endpoints producing a swagger 2.0 schema
If a swagger yaml description is found in the docstrings for an endpoint
we add the endpoint to swagger specification output

Function Documentation

◆ swagger()

def flask_swagger.swagger (   app,
  prefix = None,
  process_doc = _sanitize,
  from_file_keyword = None,
  template = None 
)
Call this from an @app.route method like this
@app.route('/spec.json')
def spec():
   return jsonify(swagger(app))

We go through all endpoints of the app searching for swagger endpoints
We provide the minimum required data according to swagger specs
Callers can and should add and override at will

Arguments:
app -- the flask app to inspect

Keyword arguments:
process_doc -- text sanitization method, the default simply replaces \n with <br>
from_file_keyword -- how to specify a file to load doc from
template -- The spec to start with and update as flask-swagger finds paths.