0

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?

pansen
  • 6,433
  • 4
  • 19
  • 32
Daniel Walker
  • 6,380
  • 5
  • 22
  • 45

1 Answers1

1

It can be accomplished via the :inherited-members: option:

.. automodule:: foo.foo
    :inherited-members: BaseModel
Daniel Walker
  • 6,380
  • 5
  • 22
  • 45