Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃摑 Add usage link to RootModel #7113

Merged
merged 1 commit into from Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/usage/models.md
Expand Up @@ -910,6 +910,9 @@ except ValidationError as e:

## `RootModel` and custom root types

??? api "API Documentation"
[`pydantic.root_model.RootModel`][pydantic.root_model.RootModel]<br>

Pydantic models can be defined with a "custom root type" by subclassing [`pydantic.RootModel`][pydantic.RootModel].

The root type can be any type supported by Pydantic, and is specified by the generic parameter to `RootModel`.
Expand Down
4 changes: 3 additions & 1 deletion pydantic/root_model.py
Expand Up @@ -25,7 +25,9 @@


class RootModel(BaseModel, typing.Generic[RootModelRootType]):
"""A Pydantic `BaseModel` for the root object of the model.
"""usage docs: https://docs.pydantic.dev/2.1/usage/models/#rootmodel-and-custom-root-types

A Pydantic `BaseModel` for the root object of the model.

Attributes:
root: The root object of the model.
Expand Down