OpenQuizz
Une application de gestion des contenus pédagogiques
apispec.ext.marshmallow.common Namespace Reference

Functions

def resolve_schema_instance (schema)
 
def resolve_schema_cls (schema)
 
def get_fields (schema, *exclude_dump_only=False)
 
def warn_if_fields_defined_in_meta (fields, Meta)
 
def filter_excluded_fields (fields, Meta, *exclude_dump_only)
 
def make_schema_key (schema)
 
def get_unique_schema_name (components, name, counter=0)
 

Variables

list MODIFIERS = ["only", "exclude", "load_only", "dump_only", "partial"]
 
 SchemaKey = namedtuple("SchemaKey", ["SchemaClass"] + MODIFIERS)
 

Detailed Description

Utilities to get schema instances/classes

Function Documentation

◆ filter_excluded_fields()

def apispec.ext.marshmallow.common.filter_excluded_fields (   fields,
  Meta,
exclude_dump_only 
)
Filter fields that should be ignored in the OpenAPI spec.

:param dict fields: A dictionary of fields name field object pairs
:param Meta: the schema's Meta class
:param bool exclude_dump_only: whether to filter dump_only fields

◆ get_fields()

def apispec.ext.marshmallow.common.get_fields (   schema,
exclude_dump_only = False 
)
Return fields from schema.

:param Schema schema: A marshmallow Schema instance or a class object
:param bool exclude_dump_only: whether to filter fields in Meta.dump_only
:rtype: dict, of field name field object pairs

◆ get_unique_schema_name()

def apispec.ext.marshmallow.common.get_unique_schema_name (   components,
  name,
  counter = 0 
)
Function to generate a unique name based on the provided name and names
already in the spec.  Will append a number to the name to make it unique if
the name is already in the spec.

:param Components components: instance of the components of the spec
:param string name: the name to use as a basis for the unique name
:param int counter: the counter of the number of recursions
:return: the unique name

◆ make_schema_key()

def apispec.ext.marshmallow.common.make_schema_key (   schema)

◆ resolve_schema_cls()

def apispec.ext.marshmallow.common.resolve_schema_cls (   schema)
Return schema class for given schema (instance or class).

:param type|Schema|str: instance, class or class name of marshmallow.Schema
:return: schema class of given schema (instance or class)

◆ resolve_schema_instance()

def apispec.ext.marshmallow.common.resolve_schema_instance (   schema)
Return schema instance for given schema (instance or class).

:param type|Schema|str schema: instance, class or class name of marshmallow.Schema
:return: schema instance of given schema (instance or class)

◆ warn_if_fields_defined_in_meta()

def apispec.ext.marshmallow.common.warn_if_fields_defined_in_meta (   fields,
  Meta 
)
Warns user that fields defined in Meta.fields or Meta.additional will be ignored.

:param dict fields: A dictionary of fields name field object pairs
:param Meta: the schema's Meta class

Variable Documentation

◆ MODIFIERS

list MODIFIERS = ["only", "exclude", "load_only", "dump_only", "partial"]

◆ SchemaKey

SchemaKey = namedtuple("SchemaKey", ["SchemaClass"] + MODIFIERS)