I'm using the autodoc_pydantic
plugin for Sphinx to document my pydantic.BaseModel
classes. However, there are cases where I have something like
class Foo(pydantic.BaseModel):
'''Foo class'''
x: str = pydantic.Field(description='The x.')
class Bar(Foo):
'''Bar class'''
y: int = pydantic.Field(description='The y.')
My .rst file contains the directive
.. automodule:: foo.foo
:members:
When the documentation is generated, only the y
field is shown for the Bar
class. Is there a way to get autodoc_pydantic
to show both x
and y
in Bar
's description?
It can be accomplished via the :inherited-members:
option:
.. automodule:: foo.foo
:inherited-members: BaseModel