You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a really neat extension which gives a nice output.
One thing which would be very nice to have is for any ClassVar on a model to be grouped separately or otherwise indicated in the list of attributes.
Currently it also shows pydantic-field for such a field when you set show_labels: true but this is misleading as a value set as ClassVar is not validated as part of the model!
A model example to recreate this:
classMyModelWithClassVar(BaseModel):
"""This is an example model with a `ClassVar`"""model_config=ConfigDict(extra="allow", use_enum_values=True)
TOP_SECRET: ClassVar[str] ="BASE""""This is a ClassVar"""a: int"""This is a model field"""b: str"""This is also a model field"""@field_validator("a")@classmethoddefcheck_a_is_big(cls, v: int, info: ValidationInfo) ->int:
ifv<10:
raiseValueError("a is too small!")
returnv
And this gives:
The text was updated successfully, but these errors were encountered:
ClassVar is shown as `pydantic-field` right now, this commit fixes it,
and shows `pydantic-classvar` instead of it.
Issue mkdocstrings#18: feature: greater distinction for model `ClassVar`
This is a really neat extension which gives a nice output.
One thing which would be very nice to have is for any
ClassVar
on a model to be grouped separately or otherwise indicated in the list of attributes.Currently it also shows
pydantic-field
for such a field when you setshow_labels: true
but this is misleading as a value set asClassVar
is not validated as part of the model!A model example to recreate this:
And this gives:

The text was updated successfully, but these errors were encountered: