with_pydantic API documentation

# with_pydantic

A small example with Pydantic entities.

View Source

     1"""
     2A small example with Pydantic entities.
     3"""
     4
     5import pydantic
     6
     7
     8class Foo(pydantic.BaseModel):
     9    """Foo class documentation."""
    10
    11    model_config = pydantic.ConfigDict(
    12        use_attribute_docstrings=True,
    13    )
    14
    15    a: int = pydantic.Field(default=1, description="Docstring for a")
    16
    17    b: int = 2
    18    """Docstring for b."""

class Foo(pydantic.main.BaseModel): View Source

     9class Foo(pydantic.BaseModel):
    10    """Foo class documentation."""
    11
    12    model_config = pydantic.ConfigDict(
    13        use_attribute_docstrings=True,
    14    )
    15
    16    a: int = pydantic.Field(default=1, description="Docstring for a")
    17
    18    b: int = 2
    19    """Docstring for b."""

Foo class documentation.

a: int = 1

Docstring for a

b: int = 2

Docstring for b.