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
Hello, I think this is a bug (not recursively resolved maybe?).
I will give two code snippets for minimal reproducers and at the very bottom is the rst code and relevant conf.py configuration (I tried with all defaults, still the same as well). My environment:
python 3.11
sphinx 7.2.6
myst-parser 2.0.0 (irrelevant to this but adding in case)
autodoc-pydantic 2.0.1
Standard Python Classes
fromtypingimportTypeAliasclassBaseClassA:
"""Base-class A."""classBaseClassB:
"""Base-class B."""compound_type: TypeAlias=BaseClassA|BaseClassBclassSomeOther:
"""Some other class. Attributes: a: is a b: is b c: is c """a: BaseClassAb: BaseClassBc: compound_type|NoneclassSubClassSomeOther(SomeOther):
"""Subclass of some other. Attributes: a: is a b: is b c: is c d: is d """d: int|None=None
As you can see, the type hints get unfolded (as expected) and propagate down to SubClassSomeOther.
Pydantic Models
frompydanticimportField, BaseModelclassPydanticBaseClassA(BaseModel):
"""Base-model A."""classPydanticBaseClassB(BaseModel):
"""Base-model B."""pydantic_compound_type: TypeAlias=PydanticBaseClassA|PydanticBaseClassBclassPydanticSomeOther(BaseModel):
"""Some other model."""a: PydanticBaseClassA=Field(..., description="is a")
b: PydanticBaseClassB=Field(..., description="is b")
c: pydantic_compound_type=Field(..., description="is c")
classPydanticSubClassSomeOther(PydanticSomeOther):
"""Subclass of some other model."""d: int|None=Field(default=None, description="is d")
As you will see below, after subclassing PydanticSomeOther as PydanticSubClassSomeOther we lost the unfolding and now our documentation doesn't know what pydantic_compound_type is.
Hello, I think this is a bug (not recursively resolved maybe?).
I will give two code snippets for minimal reproducers and at the very bottom is the
rst
code and relevantconf.py
configuration (I tried with all defaults, still the same as well). My environment:python
3.11sphinx
7.2.6myst-parser
2.0.0 (irrelevant to this but adding in case)autodoc-pydantic
2.0.1Standard Python Classes
As you can see, the type hints get unfolded (as expected) and propagate down to
SubClassSomeOther
.Pydantic Models
As you will see below, after subclassing
PydanticSomeOther
asPydanticSubClassSomeOther
we lost the unfolding and now our documentation doesn't know whatpydantic_compound_type
is.Sphinx
rst
andconf.py
The text was updated successfully, but these errors were encountered: