ft3.api.obj module

Api objects module.

class Api(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI OpenAPI Object.

info: Field[Info]
openapi: Field[str]
paths: Field[dict[str, Path]]
tags: Field[list[Tag]]
servers: Field[list[ServerObject] | None]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'components', 'info', 'openapi', 'paths', 'servers', 'tags')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

components: Field[dict[str, dict[str, Any]] | None]
classmethod register(obj_: type[ObjectType]) type[ObjectType]

Register an Object to be served from the API.

class Component(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Object

OpenAPI Component.

_ref_: Field[string[StringType] | str | None]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_',)
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Content(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI content for ContentType.

schema: Field[Schema | None]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'schema')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class File(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Object

A file object, useful for serving static files.

path: Field[str]

The path at which to serve the file.

content: Field[bytes | str]

File content.

content_type: Field[str]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('content', 'content_type', 'path')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Header(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Header Object.

description: Field[str | None]
schema: Field[Schema | None]
classmethod request(name: str, description: str | None, *methods: str) Callable[[type[ObjectType]], type[ObjectType]]

Register a request header for Object.

classmethod response(name: str, description: str | None, *methods: str) Callable[[type[ObjectType]], type[ObjectType]]

Register a response header for Object.

enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'description', 'schema')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Healthz(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Object

Default application heartbeat.

enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('status',)
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

status: Field[str]

Application status.

class Info(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Info Object.

title: Field[str]
version: Field[str]
summary: Field[str | None]
description: Field[str | None]
terms_of_service: Field[str | None]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'description', 'summary', 'terms_of_service', 'title', 'version')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Operation(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Operation Object.

description: Field[str | None]
summary: Field[str | None]
tags: Field[list[str] | None]
parameters: Field[list[Parameter] | None]
request_body: Field[RequestBody | None]
responses: Field[dict[str, ResponseObject] | None]
security: Field[list[dict[str, list[str]]] | None]
property path_uri: str

Path URI.

enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'description', 'parameters', 'request_body', 'responses', 'security', 'summary', 'tags')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Parameter(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Parameter Object.

name: Field[str | string[StringType]]
in_: Field[str]
description: Field[str | None]
required: Field[bool]
deprecated: Field[bool | None]
schema: Field[Schema | None]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {'in_': ('path', 'query', 'header', 'cookie')}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'deprecated', 'description', 'in_', 'name', 'required', 'schema')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ('name',)
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Path(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Path Item Object.

_resource_: Field[type[Object]]
summary: Field[str]
description: Field[str | None]
delete: Field[Operation | None]
get_: Field[Operation | None]
options: Field[Operation | None]
patch: Field[Operation | None]
post: Field[Operation | None]
put: Field[Operation | None]
update_options(cls: type[Object], include_default_response_headers: bool) None

Update options operation for the endpoint.

enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', '_resource_', 'delete', 'description', 'get_', 'options', 'patch', 'post', 'put', 'summary')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class RequestBody(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Request Body Object.

description: Field[str | None]
content: Field[dict[Literal['*/*', 'text/html', 'image/x-icon', 'application/json', 'image/png', 'text/plain'], Content]]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'content', 'description')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class ResponseObject(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Request Body Object.

description: Field[str]
headers: Field[dict[str, Header] | None]
content: Field[dict[Literal['*/*', 'text/html', 'image/x-icon', 'application/json', 'image/png', 'text/plain'], Content | None]]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'content', 'description', 'headers')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Schema(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Schema Object.

type_: Field[list[Literal['array', 'boolean', 'integer', 'null', 'number', 'object', 'string']] | None]
format_: Field[Literal['boolean'] | Literal['byte'] | Literal['date'] | Literal['datetime'] | Literal['double'] | Literal['float'] | Literal['int32'] | Literal['uuid'] | None]
description: Field[str | None]
default: Field[Any | None]
enum: Field[Any | None]
required: Field[list[string[camelCase]] | None]
min_length: Field[int | None]
max_length: Field[int | None]
pattern: Field[str | None]
minimum: Field[float | None]
exclusive_minimum: Field[bool | None]
maximum: Field[float | None]
exclusive_maximum: Field[bool | None]
multiple_of: Field[float | None]
min_items: Field[int | None]
max_items: Field[int | None]
unique_items: Field[bool | None]
read_only: Field[bool | None]
write_only: Field[bool | None]
items_: Field[Schema | None]
properties: Field[dict[string[camelCase], Schema] | None]
all_of: Field[list[Schema] | None]
any_of: Field[list[Schema] | None]
one_of: Field[list[Schema] | None]
classmethod from_obj(obj: type[Object], /, **kwargs: Any) Schema

Parse Schema definition from Object.

classmethod from_type(*, type_: Any = None, **kwargs: Any) Schema

Parse Schema definition from python type.

enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {'format_': ('boolean', 'byte', 'date', 'datetime', 'double', 'float', 'int32', 'uuid', None), 'type_': ('array', 'boolean', 'integer', 'null', 'number', 'object', 'string', None)}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'all_of', 'any_of', 'default', 'description', 'enum', 'exclusive_maximum', 'exclusive_minimum', 'format_', 'items_', 'max_items', 'max_length', 'maximum', 'min_items', 'min_length', 'minimum', 'multiple_of', 'one_of', 'pattern', 'properties', 'read_only', 'required', 'type_', 'unique_items', 'write_only')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class SecurityScheme(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Security Scheme Object.

type_: Field[str]
name_: Field[str]
in_: Field[str | None]
scheme: Field[str | None]
description: Field[str | None]
content: Field[dict[Literal['*/*', 'text/html', 'image/x-icon', 'application/json', 'image/png', 'text/plain'], Content]]
classmethod api_key(name: str, description: str | None, *methods: str) Callable[[type[ObjectType]], type[ObjectType]]

Register API Key SecurityScheme for Object.

enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {'in_': ('header', 'query', 'cookie', None), 'scheme': ('basic', 'bearer', None), 'type_': ('http', 'apiKey', 'oauth2', 'openIdConnect')}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'content', 'description', 'in_', 'name_', 'scheme', 'type_')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ('name_',)
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class ServerObject(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Server Object.

url: Field[str]
description: Field[str | None]
variables: Field[dict[str, ServerVariable] | None]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'description', 'url', 'variables')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class ServerVariable(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Server Variable Object.

default: Field[str]
description: Field[str | None]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'default', 'description')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ()
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

class Tag(class_as_dict: dict[str | string[StringType], Any] | None = None, /, **kwargs: Any)

Bases: Component

OpenAPI Tag Object.

name: Field[str]
description: Field[str | None]
enumerations: lib.t.ClassVar[dict[str, tuple[typ.Primitive, ...]]] = {}
fields: lib.t.ClassVar[typ.FieldsTuple] = ('_ref_', 'description', 'name')
hash_fields: lib.t.ClassVar[typ.FieldsTuple] = ('name',)
class_as_dict: lib.t.Final[lib.t.Optional[dict[typ.AnyString, lib.t.Any]]] = {}

Instantiate class directly from passed dict (assumed to be version of class in dict form).

FILES: dict[str, File] = {}

All Files served by the API.

DEFAULT_RESPONSE_HEADERS

Default response headers.

REQUEST_HEADERS: dict[str, dict[str, list[Parameter]]] = {}

All request Headers registered to the API.

RESPONSE_HEADERS: dict[str, dict[str, dict[str, Header]]] = {}

All response Headers registered to the API.

OBJECTS: dict[str, type[typ.Object]] = {}

All Objects served by the API.

SECURITY: dict[str, dict[str, list[SecurityScheme]]] = {}

All SecuritySchemes registered to the API.