RootModel
RootModel class and type definitions.
Bases: BaseModel, Generic[RootModelRootType]
Usage docs: https://docs.pydantic.dev/2.4/concepts/models/#rootmodel-and-custom-root-types
A Pydantic BaseModel for the root object of the model.
The root object of the model.
Type: RootModelRootType
Whether the model is a RootModel.
Private fields in the model.
Extra fields in the model.
@classmethod
def model_construct(
cls: type[Model],
root: RootModelRootType,
_fields_set: set[str] | None = None,
) -> Model
Create a new model using the provided root object and update fields set.
Model — The new model.
The root object of the model.
The set of fields to be updated.
NotImplemented— If the model is not a subclass ofRootModel.
def model_dump(
mode: Literal['json', 'python'] | str = 'python',
include: Any = None,
exclude: Any = None,
by_alias: bool = False,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
round_trip: bool = False,
warnings: bool = True,
) -> RootModelRootType
This method is included just to get a more accurate return type for type checkers.
It is included in this if TYPE_CHECKING: block since no override is actually necessary.
See the documentation of BaseModel.model_dump for more details about the arguments.
RootModelRootType