Module openapi_parser.model
Expand source code
from abc import ABC
from dataclasses import Field
from enum import Enum
from typing import *
from functional import Option, Some
ALLOWED_HTTP_METHODS = \
[
'get',
'put',
'post',
'delete',
'options',
'head',
'patch',
'trace',
]
class Model(ABC):
pass
T = TypeVar('T')
Z = TypeVar('Z')
class Filter(Generic[T], ABC):
def check_value(self, value: T) -> bool:
raise NotImplementedError
@property
def decoder(self) -> Optional[Callable[[Z], T]]:
raise NotImplementedError
@property
def encoder(self) -> Optional[Callable[[T], Z]]:
raise NotImplementedError
def decode(self, value: Z) -> T:
raise NotImplementedError
def encode(self, value: T) -> Z:
raise NotImplementedError
@classmethod
def empty(cls) -> Optional['Filter[T]']:
raise NotImplementedError
@property
def is_empty(self) -> bool:
raise NotImplementedError
def mix_with(self, f: 'Filter[T]') -> 'Filter[T]':
raise NotImplementedError
# region Traits
class HavingId(Model, ABC):
@property
def id(self) -> str:
raise NotImplementedError
class HavingDescription(Model, ABC):
description: Optional[str]
class HavingExtendedDescription(HavingDescription, ABC):
summary: Optional[str]
example: Optional[str]
class HavingPath(Model, ABC):
name: str
path: str
pretty_path: str
is_top_level: bool
def recursive_update(self, mapping: Callable[['HavingPath', 'HavingPath'], Any], *, ignore_top_level: bool = True):
raise NotImplementedError
class HavingValue(Model, Generic[T], ABC):
default: Option[T]
filter: Optional[Filter[T]]
class HavingStyle(Model, Generic[T], ABC):
style: Optional[str]
explode: bool
allow_reserved: bool
class HavingExternalDocs(Model, ABC):
external_docs: Optional['ModelExternalDocumentation']
# endregion
# region Helper Definitions
class ModelContact(Model, ABC):
name: Optional[str]
url: Optional[str]
email: Optional[str]
class ModelLicence(Model, ABC):
name: str
url: Optional[str]
class ModelServerVariable(HavingValue[str], HavingDescription, ABC):
default: Some[str]
class ModelExternalDocumentation(HavingDescription, ABC):
url: str
class ModelServer(HavingDescription, ABC):
url: str
variables: Optional[Dict[str, ModelServerVariable]]
class ModelTag(HavingDescription, HavingExternalDocs, ABC):
name: str
# endregion
# region Definitions
class ModelEnumData(HavingExtendedDescription, HavingPath, Generic[T], ABC):
possible_values: List[T]
base_class: Union['ModelClass', Type[T]]
def check_value(self, value: T) -> bool:
raise NotImplementedError
class ModelSchema(HavingId, HavingValue[T], HavingExtendedDescription, Generic[T], ABC):
property_name: Optional[str]
property_format: Optional[str]
nullable: bool
read_only: bool
write_only: bool
cls: Union['ModelClass', ModelEnumData, Type[T]]
@property
def metadata(self) -> Dict[str, 'ModelSchema']:
raise NotImplementedError
@property
def as_field(self) -> Field:
raise NotImplementedError
class ModelClass(HavingId, HavingExtendedDescription, HavingPath, ABC):
properties: Dict[str, ModelSchema]
required_properties: List[str]
additional_properties: Union[bool, ModelSchema]
parents: List['ModelClass']
merged: bool
@property
def all_properties_iter(self) -> Iterator[Tuple[str, ModelSchema]]:
raise NotImplementedError
@property
def all_properties(self) -> Dict[str, ModelSchema]:
raise NotImplementedError
@property
def all_required_properties_iter(self) -> Iterator[str]:
raise NotImplementedError
@property
def all_required_properties(self) -> List[str]:
raise NotImplementedError
class ParameterType(Enum):
Query = 'query'
Header = 'header'
Path = 'path'
Cookie = 'cookie'
class ModelEncodingObject(HavingStyle, ABC):
content_type: str
headers: Optional[Dict[str, 'ModelParameter']]
class ModelMediaTypeObject(Model, ABC):
schema: Optional[ModelSchema]
example: Option[T]
examples: Optional[Dict[str, T]]
encoding: Optional[Dict[str, ModelEncodingObject]]
class ModelParameter(HavingId, HavingDescription, HavingStyle, HavingPath, Generic[T], ABC):
name: str
required: bool
parameter_type: ParameterType
deprecated: bool
allow_empty_value: bool
schema: Optional[ModelSchema]
content: Optional[Dict[str, ModelMediaTypeObject]]
example: Option[T]
examples: Optional[Dict[str, T]]
class ModelRequestBodyObject(HavingDescription, HavingPath, ABC):
content: Dict[str, ModelMediaTypeObject]
required: bool
class ModelResponseObject(HavingDescription, HavingPath, ABC):
# headers: Optional[Dict[str, ModelParameter]]
content: Optional[Dict[str, ModelMediaTypeObject]]
# links: Optional[Dict[str, ModelLinkObject]] # ignored
@property
def regular_request_parser(self) -> Tuple[str, Optional[ModelMediaTypeObject]]:
raise NotImplementedError
class ModelEndpoint(HavingId, HavingExtendedDescription, HavingExternalDocs, HavingPath, ABC):
tags: Optional[List[str]]
external_docs: Optional[ModelExternalDocumentation]
operation_id: Optional[str]
request_body: Optional[ModelRequestBodyObject]
responses: Dict[str, ModelResponseObject]
default_response: Optional[ModelRequestBodyObject]
callbacks: Optional[Dict[str, 'ModelPath']] # ref may be here
deprecated: bool
security: Optional[List[Dict[str, List[str]]]]
servers: Optional[List[ModelServer]]
all_parameters: List[ModelParameter]
own_parameters: List[ModelParameter]
parent_parameters: List[ModelParameter]
@property
def regular_request_parser(self) -> Tuple[str, Optional[ModelMediaTypeObject]]:
raise NotImplementedError
@property
def regular_response(self) -> Tuple[Optional[str], Optional[ModelResponseObject]]:
raise NotImplementedError
class ModelPath(HavingId, HavingExtendedDescription, HavingPath, ABC):
endpoints: Dict[str, ModelEndpoint]
servers: Optional[ModelServer]
parameters: List[ModelParameter]
endpoint_path: str
# endregion
# region Security Definitions
class SecuritySchemeType(Enum):
ApiKey = 'apiKey'
HTTP = 'http'
OAuth2 = 'oauth2'
OpenIDConnect = 'openIdConnect'
class ModelSecurityScheme(HavingDescription, HavingPath, HavingId, ABC):
type: SecuritySchemeType
""" REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect". """
class ApiKeySecurityScheme(ModelSecurityScheme, ABC):
key_name: str
""" REQUIRED. The name of the header, query or cookie parameter to be used. """
# parameter: in
container: ParameterType
""" REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". """
class HttpSecurityScheme(ModelSecurityScheme, ABC):
scheme: str
"""
REQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1).
The values used SHOULD be registered in the [IANA Authentication Scheme registry](https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml).
"""
bearer_format: Optional[str]
""" A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. """
class OAuthFlowsType(Enum):
Implicit = 'implicit'
""" Configuration for the OAuth Implicit flow """
Password = 'password'
""" Configuration for the OAuth Resource Owner Password flow """
ClientCredentials = 'clientCredentials'
""" Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. """
AuthorizationCode = 'authorizationCode'
""" Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. """
class ModelOAuthFlow(Model, ABC):
type: OAuthFlowsType
# Only: Implicit, AuthorizationCode
authorization_url: str
""" REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL. """
# Only: Password, ClientCredentials, AuthorizationCode
token_url: str
""" REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL. """
refresh_url: Optional[str]
""" The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. """
scopes: Dict[str, str]
"""
REQUIRED. The available scopes for the OAuth2 security scheme.
A map between the scope name and a short description for it. The map MAY be empty.
"""
class OAuth2SecurityScheme(ModelSecurityScheme, ABC):
flows: Dict[OAuthFlowsType, ModelOAuthFlow]
""" REQUIRED. An object containing configuration information for the flow types supported. """
class OpenIDConnectSecurityScheme(ModelSecurityScheme, ABC):
open_id_connect_url: str
""" REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. """
# endregion
# region Meta Information
class OpenApiInfo(HavingDescription, ABC):
title: str
version: str
terms_of_service: Optional[str]
contact: Optional[ModelContact]
licence: Optional[ModelLicence]
class OpenApiMetadata(HavingExternalDocs, HavingId, ABC):
name: str
openapi: str
info: OpenApiInfo
servers: List[ModelServer]
tags: Optional[List[ModelTag]]
security: Optional[List[Dict[str, List[str]]]]
# endregion
__all__ = \
[
'ALLOWED_HTTP_METHODS',
'ApiKeySecurityScheme',
'Filter',
'HavingDescription',
'HavingExtendedDescription',
'HavingExternalDocs',
'HavingId',
'HavingPath',
'HavingStyle',
'HavingValue',
'HttpSecurityScheme',
'Model',
'ModelClass',
'ModelContact',
'ModelEncodingObject',
'ModelEndpoint',
'ModelEnumData',
'ModelExternalDocumentation',
'ModelLicence',
'ModelMediaTypeObject',
'ModelOAuthFlow',
'ModelParameter',
'ModelPath',
'ModelRequestBodyObject',
'ModelResponseObject',
'ModelSchema',
'ModelSecurityScheme',
'ModelServer',
'ModelServerVariable',
'ModelTag',
'OAuth2SecurityScheme',
'OAuthFlowsType',
'OpenApiInfo',
'OpenApiMetadata',
'OpenIDConnectSecurityScheme',
'ParameterType',
'SecuritySchemeType',
]
Classes
class ApiKeySecurityScheme
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ApiKeySecurityScheme(ModelSecurityScheme, ABC): key_name: str """ REQUIRED. The name of the header, query or cookie parameter to be used. """ # parameter: in container: ParameterType """ REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie". """
Ancestors
Subclasses
Class variables
var container : ParameterType
-
REQUIRED. The location of the API key. Valid values are "query", "header" or "cookie".
var key_name : str
-
REQUIRED. The name of the header, query or cookie parameter to be used.
Inherited members
class Filter
-
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: … # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
Expand source code
class Filter(Generic[T], ABC): def check_value(self, value: T) -> bool: raise NotImplementedError @property def decoder(self) -> Optional[Callable[[Z], T]]: raise NotImplementedError @property def encoder(self) -> Optional[Callable[[T], Z]]: raise NotImplementedError def decode(self, value: Z) -> T: raise NotImplementedError def encode(self, value: T) -> Z: raise NotImplementedError @classmethod def empty(cls) -> Optional['Filter[T]']: raise NotImplementedError @property def is_empty(self) -> bool: raise NotImplementedError def mix_with(self, f: 'Filter[T]') -> 'Filter[T]': raise NotImplementedError
Ancestors
- typing.Generic
- abc.ABC
Subclasses
Static methods
def empty() ‑> Optional[Filter[~T]]
-
Expand source code
@classmethod def empty(cls) -> Optional['Filter[T]']: raise NotImplementedError
Instance variables
var decoder : Optional[Callable[[~Z], ~T]]
-
Expand source code
@property def decoder(self) -> Optional[Callable[[Z], T]]: raise NotImplementedError
var encoder : Optional[Callable[[~T], ~Z]]
-
Expand source code
@property def encoder(self) -> Optional[Callable[[T], Z]]: raise NotImplementedError
var is_empty : bool
-
Expand source code
@property def is_empty(self) -> bool: raise NotImplementedError
Methods
def check_value(self, value: ~T) ‑> bool
-
Expand source code
def check_value(self, value: T) -> bool: raise NotImplementedError
def decode(self, value: ~Z) ‑> ~T
-
Expand source code
def decode(self, value: Z) -> T: raise NotImplementedError
def encode(self, value: ~T) ‑> ~Z
-
Expand source code
def encode(self, value: T) -> Z: raise NotImplementedError
def mix_with(self, f: Filter[T]) ‑> Filter[~T]
-
Expand source code
def mix_with(self, f: 'Filter[T]') -> 'Filter[T]': raise NotImplementedError
class HavingDescription
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class HavingDescription(Model, ABC): description: Optional[str]
Ancestors
- Model
- abc.ABC
Subclasses
- HavingExtendedDescription
- ModelExternalDocumentation
- ModelParameter
- ModelRequestBodyObject
- ModelResponseObject
- ModelSecurityScheme
- ModelServer
- ModelServerVariable
- ModelTag
- OpenApiInfo
Class variables
var description : Optional[str]
class HavingExtendedDescription
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class HavingExtendedDescription(HavingDescription, ABC): summary: Optional[str] example: Optional[str]
Ancestors
- HavingDescription
- Model
- abc.ABC
Subclasses
Class variables
var example : Optional[str]
var summary : Optional[str]
class HavingExternalDocs
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class HavingExternalDocs(Model, ABC): external_docs: Optional['ModelExternalDocumentation']
Ancestors
- Model
- abc.ABC
Subclasses
Class variables
var external_docs : Optional[ModelExternalDocumentation]
class HavingId
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class HavingId(Model, ABC): @property def id(self) -> str: raise NotImplementedError
Ancestors
- Model
- abc.ABC
Subclasses
Instance variables
var id : str
-
Expand source code
@property def id(self) -> str: raise NotImplementedError
class HavingPath
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class HavingPath(Model, ABC): name: str path: str pretty_path: str is_top_level: bool def recursive_update(self, mapping: Callable[['HavingPath', 'HavingPath'], Any], *, ignore_top_level: bool = True): raise NotImplementedError
Ancestors
- Model
- abc.ABC
Subclasses
- ModelClass
- ModelEndpoint
- ModelEnumData
- ModelParameter
- ModelPath
- ModelRequestBodyObject
- ModelResponseObject
- ModelSecurityScheme
- HavingPathImpl
- Intermediate
Class variables
var is_top_level : bool
var name : str
var path : str
var pretty_path : str
Methods
def recursive_update(self, mapping: Callable[[ForwardRef('HavingPath'), ForwardRef('HavingPath')], Any], *, ignore_top_level: bool = True)
-
Expand source code
def recursive_update(self, mapping: Callable[['HavingPath', 'HavingPath'], Any], *, ignore_top_level: bool = True): raise NotImplementedError
class HavingStyle
-
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: … # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
Expand source code
class HavingStyle(Model, Generic[T], ABC): style: Optional[str] explode: bool allow_reserved: bool
Ancestors
- Model
- typing.Generic
- abc.ABC
Subclasses
Class variables
var allow_reserved : bool
var explode : bool
var style : Optional[str]
class HavingValue
-
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: … # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
Expand source code
class HavingValue(Model, Generic[T], ABC): default: Option[T] filter: Optional[Filter[T]]
Ancestors
- Model
- typing.Generic
- abc.ABC
Subclasses
Class variables
var default : functional.option.Option[~T]
var filter : Optional[Filter[~T]]
class HttpSecurityScheme
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class HttpSecurityScheme(ModelSecurityScheme, ABC): scheme: str """ REQUIRED. The name of the HTTP Authorization scheme to be used in the [Authorization header as defined in RFC7235](https://tools.ietf.org/html/rfc7235#section-5.1). The values used SHOULD be registered in the [IANA Authentication Scheme registry](https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml). """ bearer_format: Optional[str] """ A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes. """
Ancestors
Subclasses
Class variables
var bearer_format : Optional[str]
-
A hint to the client to identify how the bearer token is formatted. Bearer tokens are usually generated by an authorization server, so this information is primarily for documentation purposes.
var scheme : str
-
REQUIRED. The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry.
Inherited members
class Model
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class Model(ABC): pass
Ancestors
- abc.ABC
Subclasses
class ModelClass
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelClass(HavingId, HavingExtendedDescription, HavingPath, ABC): properties: Dict[str, ModelSchema] required_properties: List[str] additional_properties: Union[bool, ModelSchema] parents: List['ModelClass'] merged: bool @property def all_properties_iter(self) -> Iterator[Tuple[str, ModelSchema]]: raise NotImplementedError @property def all_properties(self) -> Dict[str, ModelSchema]: raise NotImplementedError @property def all_required_properties_iter(self) -> Iterator[str]: raise NotImplementedError @property def all_required_properties(self) -> List[str]: raise NotImplementedError
Ancestors
Subclasses
Class variables
var additional_properties : Union[bool, ModelSchema]
var merged : bool
var parents : List[ModelClass]
var properties : Dict[str, ModelSchema]
var required_properties : List[str]
Instance variables
var all_properties : Dict[str, ModelSchema]
-
Expand source code
@property def all_properties(self) -> Dict[str, ModelSchema]: raise NotImplementedError
var all_properties_iter : Iterator[Tuple[str, ModelSchema]]
-
Expand source code
@property def all_properties_iter(self) -> Iterator[Tuple[str, ModelSchema]]: raise NotImplementedError
var all_required_properties : List[str]
-
Expand source code
@property def all_required_properties(self) -> List[str]: raise NotImplementedError
var all_required_properties_iter : Iterator[str]
-
Expand source code
@property def all_required_properties_iter(self) -> Iterator[str]: raise NotImplementedError
class ModelContact
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelContact(Model, ABC): name: Optional[str] url: Optional[str] email: Optional[str]
Ancestors
- Model
- abc.ABC
Subclasses
Class variables
var email : Optional[str]
var name : Optional[str]
var url : Optional[str]
class ModelEncodingObject
-
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: … # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
Expand source code
class ModelEncodingObject(HavingStyle, ABC): content_type: str headers: Optional[Dict[str, 'ModelParameter']]
Ancestors
- HavingStyle
- Model
- typing.Generic
- abc.ABC
Subclasses
Class variables
var content_type : str
var headers : Optional[Dict[str, ModelParameter]]
class ModelEndpoint
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelEndpoint(HavingId, HavingExtendedDescription, HavingExternalDocs, HavingPath, ABC): tags: Optional[List[str]] external_docs: Optional[ModelExternalDocumentation] operation_id: Optional[str] request_body: Optional[ModelRequestBodyObject] responses: Dict[str, ModelResponseObject] default_response: Optional[ModelRequestBodyObject] callbacks: Optional[Dict[str, 'ModelPath']] # ref may be here deprecated: bool security: Optional[List[Dict[str, List[str]]]] servers: Optional[List[ModelServer]] all_parameters: List[ModelParameter] own_parameters: List[ModelParameter] parent_parameters: List[ModelParameter] @property def regular_request_parser(self) -> Tuple[str, Optional[ModelMediaTypeObject]]: raise NotImplementedError @property def regular_response(self) -> Tuple[Optional[str], Optional[ModelResponseObject]]: raise NotImplementedError
Ancestors
Subclasses
Class variables
var all_parameters : List[ModelParameter]
var callbacks : Optional[Dict[str, ModelPath]]
var default_response : Optional[ModelRequestBodyObject]
var deprecated : bool
var external_docs : Optional[ModelExternalDocumentation]
var operation_id : Optional[str]
var own_parameters : List[ModelParameter]
var parent_parameters : List[ModelParameter]
var request_body : Optional[ModelRequestBodyObject]
var responses : Dict[str, ModelResponseObject]
var security : Optional[List[Dict[str, List[str]]]]
var servers : Optional[List[ModelServer]]
Instance variables
var regular_request_parser : Tuple[str, Optional[ModelMediaTypeObject]]
-
Expand source code
@property def regular_request_parser(self) -> Tuple[str, Optional[ModelMediaTypeObject]]: raise NotImplementedError
var regular_response : Tuple[Optional[str], Optional[ModelResponseObject]]
-
Expand source code
@property def regular_response(self) -> Tuple[Optional[str], Optional[ModelResponseObject]]: raise NotImplementedError
class ModelEnumData
-
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: … # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
Expand source code
class ModelEnumData(HavingExtendedDescription, HavingPath, Generic[T], ABC): possible_values: List[T] base_class: Union['ModelClass', Type[T]] def check_value(self, value: T) -> bool: raise NotImplementedError
Ancestors
- HavingExtendedDescription
- HavingDescription
- HavingPath
- Model
- typing.Generic
- abc.ABC
Subclasses
Class variables
var base_class : Union[ModelClass, Type[~T]]
var possible_values : List[~T]
Methods
def check_value(self, value: ~T) ‑> bool
-
Expand source code
def check_value(self, value: T) -> bool: raise NotImplementedError
class ModelExternalDocumentation
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelExternalDocumentation(HavingDescription, ABC): url: str
Ancestors
- HavingDescription
- Model
- abc.ABC
Subclasses
Class variables
var url : str
class ModelLicence
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelLicence(Model, ABC): name: str url: Optional[str]
Ancestors
- Model
- abc.ABC
Subclasses
Class variables
var name : str
var url : Optional[str]
class ModelMediaTypeObject
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelMediaTypeObject(Model, ABC): schema: Optional[ModelSchema] example: Option[T] examples: Optional[Dict[str, T]] encoding: Optional[Dict[str, ModelEncodingObject]]
Ancestors
- Model
- abc.ABC
Subclasses
Class variables
var encoding : Optional[Dict[str, ModelEncodingObject]]
var example : functional.option.Option[~T]
var examples : Optional[Dict[str, ~T]]
var schema : Optional[ModelSchema]
class ModelOAuthFlow
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelOAuthFlow(Model, ABC): type: OAuthFlowsType # Only: Implicit, AuthorizationCode authorization_url: str """ REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL. """ # Only: Password, ClientCredentials, AuthorizationCode token_url: str """ REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL. """ refresh_url: Optional[str] """ The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL. """ scopes: Dict[str, str] """ REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty. """
Ancestors
- Model
- abc.ABC
Subclasses
Class variables
-
REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
var refresh_url : Optional[str]
-
The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
var scopes : Dict[str, str]
-
REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty.
var token_url : str
-
REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
var type : OAuthFlowsType
class ModelParameter
-
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: … # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
Expand source code
class ModelParameter(HavingId, HavingDescription, HavingStyle, HavingPath, Generic[T], ABC): name: str required: bool parameter_type: ParameterType deprecated: bool allow_empty_value: bool schema: Optional[ModelSchema] content: Optional[Dict[str, ModelMediaTypeObject]] example: Option[T] examples: Optional[Dict[str, T]]
Ancestors
- HavingId
- HavingDescription
- HavingStyle
- HavingPath
- Model
- typing.Generic
- abc.ABC
Subclasses
Class variables
var allow_empty_value : bool
var content : Optional[Dict[str, ModelMediaTypeObject]]
var deprecated : bool
var example : functional.option.Option[~T]
var examples : Optional[Dict[str, ~T]]
var name : str
var parameter_type : ParameterType
var required : bool
var schema : Optional[ModelSchema]
class ModelPath
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelPath(HavingId, HavingExtendedDescription, HavingPath, ABC): endpoints: Dict[str, ModelEndpoint] servers: Optional[ModelServer] parameters: List[ModelParameter] endpoint_path: str
Ancestors
Subclasses
Class variables
var endpoint_path : str
var endpoints : Dict[str, ModelEndpoint]
var parameters : List[ModelParameter]
var servers : Optional[ModelServer]
class ModelRequestBodyObject
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelRequestBodyObject(HavingDescription, HavingPath, ABC): content: Dict[str, ModelMediaTypeObject] required: bool
Ancestors
- HavingDescription
- HavingPath
- Model
- abc.ABC
Subclasses
Class variables
var content : Dict[str, ModelMediaTypeObject]
var required : bool
class ModelResponseObject
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelResponseObject(HavingDescription, HavingPath, ABC): # headers: Optional[Dict[str, ModelParameter]] content: Optional[Dict[str, ModelMediaTypeObject]] # links: Optional[Dict[str, ModelLinkObject]] # ignored @property def regular_request_parser(self) -> Tuple[str, Optional[ModelMediaTypeObject]]: raise NotImplementedError
Ancestors
- HavingDescription
- HavingPath
- Model
- abc.ABC
Subclasses
Class variables
var content : Optional[Dict[str, ModelMediaTypeObject]]
Instance variables
var regular_request_parser : Tuple[str, Optional[ModelMediaTypeObject]]
-
Expand source code
@property def regular_request_parser(self) -> Tuple[str, Optional[ModelMediaTypeObject]]: raise NotImplementedError
class ModelSchema
-
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: … # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
Expand source code
class ModelSchema(HavingId, HavingValue[T], HavingExtendedDescription, Generic[T], ABC): property_name: Optional[str] property_format: Optional[str] nullable: bool read_only: bool write_only: bool cls: Union['ModelClass', ModelEnumData, Type[T]] @property def metadata(self) -> Dict[str, 'ModelSchema']: raise NotImplementedError @property def as_field(self) -> Field: raise NotImplementedError
Ancestors
- HavingId
- HavingValue
- HavingExtendedDescription
- HavingDescription
- Model
- typing.Generic
- abc.ABC
Subclasses
Class variables
var cls : Union[ModelClass, ModelEnumData, Type[~T]]
var nullable : bool
var property_format : Optional[str]
var property_name : Optional[str]
var read_only : bool
var write_only : bool
Instance variables
var as_field : dataclasses.Field
-
Expand source code
@property def as_field(self) -> Field: raise NotImplementedError
var metadata : Dict[str, ModelSchema]
-
Expand source code
@property def metadata(self) -> Dict[str, 'ModelSchema']: raise NotImplementedError
class ModelSecurityScheme
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelSecurityScheme(HavingDescription, HavingPath, HavingId, ABC): type: SecuritySchemeType """ REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect". """
Ancestors
- HavingDescription
- HavingPath
- HavingId
- Model
- abc.ABC
Subclasses
- ApiKeySecurityScheme
- HttpSecurityScheme
- OAuth2SecurityScheme
- OpenIDConnectSecurityScheme
- ModelSecuritySchemeImpl
Class variables
var type : SecuritySchemeType
-
REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
class ModelServer
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelServer(HavingDescription, ABC): url: str variables: Optional[Dict[str, ModelServerVariable]]
Ancestors
- HavingDescription
- Model
- abc.ABC
Subclasses
Class variables
var url : str
var variables : Optional[Dict[str, ModelServerVariable]]
class ModelServerVariable
-
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def getitem(self, key: KT) -> VT: … # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
Expand source code
class ModelServerVariable(HavingValue[str], HavingDescription, ABC): default: Some[str]
Ancestors
- HavingValue
- HavingDescription
- Model
- typing.Generic
- abc.ABC
Subclasses
Class variables
var default : functional.option.Some[str]
class ModelTag
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class ModelTag(HavingDescription, HavingExternalDocs, ABC): name: str
Ancestors
- HavingDescription
- HavingExternalDocs
- Model
- abc.ABC
Subclasses
Class variables
var name : str
class OAuth2SecurityScheme
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class OAuth2SecurityScheme(ModelSecurityScheme, ABC): flows: Dict[OAuthFlowsType, ModelOAuthFlow] """ REQUIRED. An object containing configuration information for the flow types supported. """
Ancestors
Subclasses
Class variables
var flows : Dict[OAuthFlowsType, ModelOAuthFlow]
-
REQUIRED. An object containing configuration information for the flow types supported.
Inherited members
class OAuthFlowsType (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
An enumeration.
Expand source code
class OAuthFlowsType(Enum): Implicit = 'implicit' """ Configuration for the OAuth Implicit flow """ Password = 'password' """ Configuration for the OAuth Resource Owner Password flow """ ClientCredentials = 'clientCredentials' """ Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0. """ AuthorizationCode = 'authorizationCode' """ Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. """
Ancestors
- enum.Enum
Class variables
var AuthorizationCode
-
Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0.
var ClientCredentials
-
Configuration for the OAuth Client Credentials flow. Previously called application in OpenAPI 2.0.
var Implicit
-
Configuration for the OAuth Implicit flow
var Password
-
Configuration for the OAuth Resource Owner Password flow
class OpenApiInfo
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class OpenApiInfo(HavingDescription, ABC): title: str version: str terms_of_service: Optional[str] contact: Optional[ModelContact] licence: Optional[ModelLicence]
Ancestors
- HavingDescription
- Model
- abc.ABC
Subclasses
Class variables
var contact : Optional[ModelContact]
var licence : Optional[ModelLicence]
var terms_of_service : Optional[str]
var title : str
var version : str
class OpenApiMetadata
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class OpenApiMetadata(HavingExternalDocs, HavingId, ABC): name: str openapi: str info: OpenApiInfo servers: List[ModelServer] tags: Optional[List[ModelTag]] security: Optional[List[Dict[str, List[str]]]]
Ancestors
- HavingExternalDocs
- HavingId
- Model
- abc.ABC
Subclasses
Class variables
var info : OpenApiInfo
var name : str
var openapi : str
var security : Optional[List[Dict[str, List[str]]]]
var servers : List[ModelServer]
class OpenIDConnectSecurityScheme
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class OpenIDConnectSecurityScheme(ModelSecurityScheme, ABC): open_id_connect_url: str """ REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL. """
Ancestors
Subclasses
Class variables
var open_id_connect_url : str
-
REQUIRED. OpenId Connect URL to discover OAuth2 configuration values. This MUST be in the form of a URL.
Inherited members
class ParameterType (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
An enumeration.
Expand source code
class ParameterType(Enum): Query = 'query' Header = 'header' Path = 'path' Cookie = 'cookie'
Ancestors
- enum.Enum
Class variables
var Cookie
var Header
var Path
var Query
class SecuritySchemeType (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
An enumeration.
Expand source code
class SecuritySchemeType(Enum): ApiKey = 'apiKey' HTTP = 'http' OAuth2 = 'oauth2' OpenIDConnect = 'openIdConnect'
Ancestors
- enum.Enum
Class variables
var ApiKey
var HTTP
var OAuth2
var OpenIDConnect