OpenQuizz
Une application de gestion des contenus pédagogiques
flask_restx.swagger Namespace Reference

Data Structures

class  Swagger
 

Functions

def ref (model)
 
def extract_path (path)
 
def extract_path_params (path)
 
def parse_docstring (obj)
 
def is_hidden (resource, route_doc=None)
 
def build_request_body_parameters_schema (body_params)
 

Variables

dictionary PATH_TYPES
 
dictionary PY_TYPES
 
 RE_URL = re.compile(r"<(?:[^:<>]+:)?([^<>]+)>")
 
string DEFAULT_RESPONSE_DESCRIPTION = "Success"
 
dictionary DEFAULT_RESPONSE = {"description": DEFAULT_RESPONSE_DESCRIPTION}
 
 RE_RAISES
 

Function Documentation

◆ build_request_body_parameters_schema()

def flask_restx.swagger.build_request_body_parameters_schema (   body_params)
:param body_params: List of JSON schema of body parameters.
:type body_params: list of dict, generated from the json body parameters of a request parser
:return dict: The Swagger schema representation of the request body

:Example:
    {
        'name': 'payload',
        'required': True,
        'in': 'body',
        'schema': {
            'type': 'object',
            'properties': [
                'parameter1': {
                    'type': 'integer'
                },
                'parameter2': {
                    'type': 'string'
                }
            ]
        }
    }

◆ extract_path()

def flask_restx.swagger.extract_path (   path)
Transform a Flask/Werkzeug URL pattern in a Swagger one.

◆ extract_path_params()

def flask_restx.swagger.extract_path_params (   path)
Extract Flask-style parameters from an URL pattern as Swagger ones.

◆ is_hidden()

def flask_restx.swagger.is_hidden (   resource,
  route_doc = None 
)
Determine whether a Resource has been hidden from Swagger documentation
i.e. by using Api.doc(False) decorator

◆ parse_docstring()

def flask_restx.swagger.parse_docstring (   obj)

◆ ref()

def flask_restx.swagger.ref (   model)
Return a reference to model in definitions

Variable Documentation

◆ DEFAULT_RESPONSE

dictionary DEFAULT_RESPONSE = {"description": DEFAULT_RESPONSE_DESCRIPTION}

◆ DEFAULT_RESPONSE_DESCRIPTION

string DEFAULT_RESPONSE_DESCRIPTION = "Success"

◆ PATH_TYPES

dictionary PATH_TYPES
Initial value:
1 = {
2  "int": "integer",
3  "float": "number",
4  "string": "string",
5  "default": "string",
6 }

◆ PY_TYPES

dictionary PY_TYPES
Initial value:
1 = {
2  int: "integer",
3  float: "number",
4  str: "string",
5  bool: "boolean",
6  None: "void",
7 }

◆ RE_RAISES

RE_RAISES
Initial value:
1 = re.compile(
2  r"^:raises\s+(?P<name>[\w\d_]+)\s*:\s*(?P<description>.*)$", re.MULTILINE
3 )

◆ RE_URL

RE_URL = re.compile(r"<(?:[^:<>]+:)?([^<>]+)>")