Skip to content

bug: Constraints are not visible in Documentation #35

@N1k145

Description

@N1k145

Description of the bug

In the example on the index page of the documentation here I understand this as that the contraints should be part of the documentation

    field_with_constraints_and_description: int = Field(
        default=5, ge=0, le=100, description="Shows constraints within doc string."
    )

Image

But for me this is only the default value and I am unable to get other contraints to work, like the max-length of a string

To Reproduce

class ModelElement(BaseModel):
    name: str = Field(max_length=255)
    """The name of the model element"""

Expected behavior

I would like to see the contrains as part of the documentation

Environment information

  • System: Windows-11-10.0.22631-SP0
  • Python: cpython 3.13.3 (D:[...].venv\Scripts\python.exe)
  • Environment variables:
  • Installed packages:
    • griffe-pydantic v1.1.4

Additional context

Im running it directly as an mkdocs-extension with the same setup as in this repo

                    options:
                        docstring_options:
                            ignore_init_summary: true
                        docstring_section_style: list
                        filters: [ "!^_" ]
                        heading_level: 1
                        inherited_members: true
                        merge_init_into_class: true
                        separate_signature: true
                        show_root_heading: true
                        show_root_full_path: false
                        show_signature_annotations: true
                        show_source: false
                        show_symbol_type_heading: true
                        show_symbol_type_toc: true
                        signature_crossrefs: true
                        summary: true
                        extensions:
                            -   griffe_pydantic:
                                    schema: true

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