Skip to content

Field docstring descriptions are not automatically added to schema #366

@ml-evs

Description

@ml-evs

Through some oversight on my part, when you do

from pydantic import BaseModel

class A(BaseModel):
   a: int
   """Integer counting a"""

the docstring for A.a does not get used to populate the JSONSchema. I think I used to do this with the pydantic_settings package, which has sinced removed the feature, and apparently this will be implemented proper in pydantic v2. But for now we have no descriptions in our schema, unless we explicitly do Field(description=...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/lowschemaFor issues/PRs pertaining to data models and schemas

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions