Skip to content

feature: Show pydantic field title #32

@tejupelt

Description

@tejupelt

Is your feature request related to a problem? Please describe.

A pydantic.BaseModel field can have a title in addition to description. Currently the description is properly shown in the model documentation, but the title is not included at all.

Describe the solution you'd like

Include the field title in addition to the description in the model documentation.

The question is then how to combine the title and description in the documentation. Maybe separate these by a newline or a period, or make it configurable.

Describe alternatives you've considered

If there's a good reason to not show the title, a warning should be emitted whenever a pydantic.BaseModel has titles in its fields.

Additional context

The griffe-pydantic documentation example works as a good example. Just add a title to any of the fields to see how it is currently ignored.

By glancing at the code, it seems that the relevant function is griffe_pydantic._internal.dynamic._process_attribute and more concretely the docstring population at the end of that function.

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions