Skip to content

NoCast

faststream.utils.NoCast #

NoCast()

Bases: CustomField

A class that represents a custom field without casting.

You can use it to annotate fields, that should not be casted.

Usage:

data: Annotated[..., NoCast()]

Source code in faststream/utils/no_cast.py
def __init__(self) -> None:
    super().__init__(cast=False)

param_name instance-attribute #

param_name = None

cast instance-attribute #

cast = cast

required instance-attribute #

required = required

field instance-attribute #

field = False

set_param_name #

set_param_name(name)
Source code in fast_depends/library/model.py
def set_param_name(self: Cls, name: str) -> Cls:
    self.param_name = name
    return self

use_field #

use_field(kwargs)
Source code in fast_depends/library/model.py
def use_field(self, kwargs: Dict[str, Any]) -> None:
    raise NotImplementedError("You should implement `use_field` method.")

use #

use(**kwargs)
Source code in faststream/utils/no_cast.py
def use(self, **kwargs: Any) -> AnyDict:
    return kwargs