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

Public Member Functions

def __init__ (self, title, version, openapi_version, plugins=(), **options)
 
def to_dict (self)
 
def to_yaml (self, yaml_dump_kwargs=None)
 
def tag (self, tag)
 
def path (self, path=None, *operations=None, summary=None, description=None, parameters=None, **kwargs)
 
def get_ref (self, obj_type, obj)
 
def clean_parameters (self, parameters)
 
def clean_operations (self, operations)
 

Data Fields

 title
 
 version
 
 openapi_version
 
 options
 
 plugins
 
 components
 

Detailed Description

Stores metadata that describes a RESTful API using the OpenAPI specification.

:param str title: API title
:param str version: API version
:param list|tuple plugins: Plugin instances.
    See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#infoObject
:param str|OpenAPIVersion openapi_version: OpenAPI Specification version.
    Should be in the form '2.x' or '3.x.x' to comply with the OpenAPI standard.
:param options: Optional top-level keys
    See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#openapi-object

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  title,
  version,
  openapi_version,
  plugins = (),
**  options 
)

Member Function Documentation

◆ clean_operations()

def clean_operations (   self,
  operations 
)
Ensure that all parameters with "in" equal to "path" are also required
as required by the OpenAPI specification, as well as normalizing any
references to global parameters. Also checks for invalid HTTP methods.

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

:param dict operations: Dict mapping status codes to operations

◆ clean_parameters()

def clean_parameters (   self,
  parameters 
)
Ensure that all parameters with "in" equal to "path" are also required
as required by the OpenAPI specification, as well as normalizing any
references to global parameters and checking for duplicates parameters

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

:param list parameters: List of parameters mapping

◆ get_ref()

def get_ref (   self,
  obj_type,
  obj 
)
Return object or reference

If obj is a dict, it is assumed to be a complete description and it is returned as is.
Otherwise, it is assumed to be a reference name as string and the corresponding $ref
string is returned.

:param str obj_type: "schema", "parameter", "response" or "security_scheme"
:param dict|str obj: object in dict form or as ref_id string

◆ path()

def path (   self,
  path = None,
operations = None,
  summary = None,
  description = None,
  parameters = None,
**  kwargs 
)
Add a new path object to the spec.

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

:param str|None path: URL path component
:param dict|None operations: describes the http methods and options for `path`
:param str summary: short summary relevant to all operations in this path
:param str description: long description relevant to all operations in this path
:param list|None parameters: list of parameters relevant to all operations in this path
:param kwargs: parameters used by any path helpers see :meth:`register_path_helper`

◆ tag()

def tag (   self,
  tag 
)
Store information about a tag.

:param dict tag: the dictionary storing information about the tag.

◆ to_dict()

def to_dict (   self)

◆ to_yaml()

def to_yaml (   self,
  yaml_dump_kwargs = None 
)
Render the spec to YAML. Requires PyYAML to be installed.

:param dict yaml_dump_kwargs: Additional keyword arguments to pass to `yaml.dump`

Field Documentation

◆ components

components

◆ openapi_version

openapi_version

◆ options

options

◆ plugins

plugins

◆ title

title

◆ version

version

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