connexion.spec
¶
This module defines Python interfaces for OpenAPI specifications.
Module Contents¶
Classes¶
Python interface for a Swagger 2 specification. |
|
Python interface for an OpenAPI 3 specification. |
Functions¶
|
Create a Validator to validate an OpenAPI spec against the OpenAPI schema. |
|
Make given "basePath" a canonical base URL which can be prepended to paths starting with "/". |
Attributes¶
- connexion.spec.validate_properties¶
- connexion.spec.create_spec_validator(spec: dict) jsonschema.Draft4Validator ¶
Create a Validator to validate an OpenAPI spec against the OpenAPI schema.
- Parameters:
spec – specification to validate
- connexion.spec.NO_SPEC_VERSION_ERR_MSG = Multiline-String¶
Show Value
1Unable to get the spec version. 2You are missing either '"swagger": "2.0"' or '"openapi": "3.0.0"' 3from the top level of your spec.
- connexion.spec.canonical_base_path(base_path)¶
Make given “basePath” a canonical base URL which can be prepended to paths starting with “/”.
- class connexion.spec.Specification(raw_spec)¶
Bases:
collections.abc.Mapping
- __slots__ = []¶
A Mapping is a generic container for associating key/value pairs.
This class provides concrete generic implementations of all methods except for __getitem__, __iter__, and __len__.
- __reversed__¶
- get_path_params(self, path)¶
- get_operation(self, path, method)¶
- property raw(self)¶
- property version(self)¶
- property security(self)¶
- __getitem__(self, k)¶
- __iter__(self)¶
- __len__(self)¶
- classmethod from_file(cls, spec, arguments=None)¶
Takes in a path to a YAML file, and returns a Specification
- classmethod from_dict(cls, spec)¶
Takes in a dictionary, and returns a Specification
- clone(self)¶
- classmethod load(cls, spec, arguments=None)¶
- with_base_path(self, base_path)¶
- get(self, key, default=None)¶
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- __contains__(self, key)¶
- keys(self)¶
D.keys() -> a set-like object providing a view on D’s keys
- items(self)¶
D.items() -> a set-like object providing a view on D’s items
- values(self)¶
D.values() -> an object providing a view on D’s values
- __eq__(self, other)¶
Return self==value.
- classmethod __subclasshook__(cls, C)¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- class connexion.spec.Swagger2Specification(raw_spec)¶
Bases:
Specification
Python interface for a Swagger 2 specification.
- yaml_name = swagger.yaml¶
- operation_cls¶
- openapi_schema¶
- __slots__ = []¶
A Mapping is a generic container for associating key/value pairs.
This class provides concrete generic implementations of all methods except for __getitem__, __iter__, and __len__.
- __reversed__¶
- property produces(self)¶
- property consumes(self)¶
- property definitions(self)¶
- property parameter_definitions(self)¶
- property response_definitions(self)¶
- property security_definitions(self)¶
- property base_path(self)¶
- get_path_params(self, path)¶
- get_operation(self, path, method)¶
- property raw(self)¶
- property version(self)¶
- property security(self)¶
- __getitem__(self, k)¶
- __iter__(self)¶
- __len__(self)¶
- classmethod from_file(cls, spec, arguments=None)¶
Takes in a path to a YAML file, and returns a Specification
- classmethod from_dict(cls, spec)¶
Takes in a dictionary, and returns a Specification
- clone(self)¶
- classmethod load(cls, spec, arguments=None)¶
- with_base_path(self, base_path)¶
- get(self, key, default=None)¶
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- __contains__(self, key)¶
- keys(self)¶
D.keys() -> a set-like object providing a view on D’s keys
- items(self)¶
D.items() -> a set-like object providing a view on D’s items
- values(self)¶
D.values() -> an object providing a view on D’s values
- __eq__(self, other)¶
Return self==value.
- classmethod __subclasshook__(cls, C)¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- class connexion.spec.OpenAPISpecification(raw_spec)¶
Bases:
Specification
Python interface for an OpenAPI 3 specification.
- yaml_name = openapi.yaml¶
- operation_cls¶
- openapi_schema¶
- __slots__ = []¶
A Mapping is a generic container for associating key/value pairs.
This class provides concrete generic implementations of all methods except for __getitem__, __iter__, and __len__.
- __reversed__¶
- property security_definitions(self)¶
- property components(self)¶
- property base_path(self)¶
- get_path_params(self, path)¶
- get_operation(self, path, method)¶
- property raw(self)¶
- property version(self)¶
- property security(self)¶
- __getitem__(self, k)¶
- __iter__(self)¶
- __len__(self)¶
- classmethod from_file(cls, spec, arguments=None)¶
Takes in a path to a YAML file, and returns a Specification
- classmethod from_dict(cls, spec)¶
Takes in a dictionary, and returns a Specification
- clone(self)¶
- classmethod load(cls, spec, arguments=None)¶
- with_base_path(self, base_path)¶
- get(self, key, default=None)¶
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- __contains__(self, key)¶
- keys(self)¶
D.keys() -> a set-like object providing a view on D’s keys
- items(self)¶
D.items() -> a set-like object providing a view on D’s items
- values(self)¶
D.values() -> an object providing a view on D’s values
- __eq__(self, other)¶
Return self==value.
- classmethod __subclasshook__(cls, C)¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).