Skip to content

Commit

Permalink
📝 Add usage link to RootModel (#7113)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Aug 14, 2023
1 parent d70abd8 commit fb74946
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit fb74946

Please sign in to comment.