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

Public Member Functions

def __init__ (self, plugins, openapi_version)
 
def to_dict (self)
 
def schema (self, name, component=None, **kwargs)
 
def response (self, component_id, component=None, **kwargs)
 
def parameter (self, component_id, location, component=None, **kwargs)
 
def header (self, component_id, component)
 
def example (self, name, component, **kwargs)
 
def security_scheme (self, component_id, component)
 

Data Fields

 openapi_version
 
 schemas
 
 responses
 
 parameters
 
 headers
 
 examples
 
 security_schemes
 

Detailed Description

Stores OpenAPI components

Components are top-level fields in OAS v2.
They became sub-fields of "components" top-level field in OAS v3.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  plugins,
  openapi_version 
)

Member Function Documentation

◆ example()

def example (   self,
  name,
  component,
**  kwargs 
)
Add an example which can be referenced

:param str name: identifier by which example may be referenced.
:param dict component: example fields.

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#exampleObject

◆ header()

def header (   self,
  component_id,
  component 
)
Add a header which can be referenced.

:param str component_id: identifier by which header may be referenced.
:param dict component: header fields.

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#headerObject

◆ parameter()

def parameter (   self,
  component_id,
  location,
  component = None,
**  kwargs 
)
Add a parameter which can be referenced.

:param str component_id: identifier by which parameter may be referenced.
:param str location: location of the parameter.
:param dict component: parameter fields.
:param kwargs: plugin-specific arguments

◆ response()

def response (   self,
  component_id,
  component = None,
**  kwargs 
)
Add a response which can be referenced.

:param str component_id: ref_id to use as reference
:param dict component: response fields
:param kwargs: plugin-specific arguments

◆ schema()

def schema (   self,
  name,
  component = None,
**  kwargs 
)
Add a new schema to the spec.

:param str name: identifier by which schema may be referenced.
:param dict component: schema definition.

.. note::

    If you are using `apispec.ext.marshmallow`, you can pass fields' metadata as
    additional keyword arguments.

    For example, to add ``enum`` and ``description`` to your field: ::

status = fields.String(
    required=True,
    metadata={
        "description": "Status (open or closed)",
        "enum": ["open", "closed"],
    },
)

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#schemaObject

◆ security_scheme()

def security_scheme (   self,
  component_id,
  component 
)
Add a security scheme which can be referenced.

:param str component_id: component_id to use as reference
:param dict component: security scheme fields

◆ to_dict()

def to_dict (   self)

Field Documentation

◆ examples

examples

◆ headers

headers

◆ openapi_version

openapi_version

◆ parameters

parameters

◆ responses

responses

◆ schemas

schemas

◆ security_schemes

security_schemes

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