Skip to content

bug: Inherited fields does not show up in documentation automatically (in fields section) #17

@mmzeynalli

Description

@mmzeynalli

Description of the bug

I have complex structure of Pydantic models. I have one model that inherits 5-6 fields from another model and adds its two fields. However, when docuemntation is generated, in fields section, only two fields are shown, BUT the rest of the doc with all attributes is okay, even inherited ones.

To Reproduce

from pydantic import AliasGenerator, BaseModel, ConfigDict, Field, field_validator, model_validator

class AuthCallbackSchema(BaseModel):
    model_config = ConfigDict(alias_generator=AliasGenerator(validation_alias=str.upper))

    rc: str = Field(min_length=2, max_length=2)
    """Əməliyyat cavab kodu (ISO-8583 Sahə 39)"""

    approval: Optional[str] = Field(..., min_length=6, max_length=6)
    """Müştəri bankının təsdiq kodu (ISO-8583 Sahə 38). Kart idarəetmə sistemi
    tərəfindən təmin edilmədikdə boş ola bilər."""

    rrn: str = Field(min_length=12, max_length=12)
    """Müştəri bankının axtarış istinad nömrəsi (ISO-8583 Sahə 37)"""

    int_ref: str = Field(min_length=1, max_length=128)
    """Elektron ticarət şlüzünün daxili istinad nömrəsi"""

    p_sign: str = Field(min_length=1, max_length=256)
    """16-lıq formatda Merchant MAC"""


class AuthCallbackWithCardDataSchema(AuthCallbackSchema):
    card: Optional[str]
    """Masklanmış kart nömrəsi"""

    token: Optional[str]
    """Saxlanılacaq kartın TOKEN parametri"""

and in MD file:

::: integrify.azericard.schemas.callback.AuthCallbackSchema

::: integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema

Result:

image

Notice how fields section has only two, but in the ToC you can see all inherited fields as well, documented and all right.

Full traceback

Full traceback
DEBUG   -  mkdocstrings: Matched '::: integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema'
DEBUG   -  mkdocstrings: Using handler 'python'
DEBUG   -  mkdocstrings: Collecting data
DEBUG   -  griffe: Searching path(s) for integrify
DEBUG   -  griffe: Found integrify: loading
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/__init__.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/api.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/logger.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/schemas.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/__init__.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/__init__.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/helper.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/env.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/client.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/handlers.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/schemas/__init__.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/handler.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/client.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/env.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/schemas/__init__.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/schemas/request.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/schemas/callback.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/schemas/enums.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/epoint/schemas/response.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/schemas/callback.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/schemas/common.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/schemas/enums.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/schemas/request.py
DEBUG   -  griffe: Loading path /home/miradilz/Projects/integrify/src/integrify/azericard/schemas/response.py
DEBUG   -  griffe: Base class str is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class enum.Enum is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class pydantic.BaseModel is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class typing.Generic is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class pydantic.BaseModel is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class pydantic.BaseModel is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class pydantic.BaseModel is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class str is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class enum.Enum is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class str is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class enum.Enum is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class pydantic.BaseModel is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class pydantic.BaseModel is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class str is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class enum.Enum is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class int is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class enum.Enum is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class str is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class enum.Enum is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class typing.TypedDict is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class typing.TypedDict is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class pydantic.BaseModel is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class str is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class enum.Enum is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class str is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class enum.Enum is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class str is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Base class enum.Enum is not loaded, or not static, it cannot be resolved
DEBUG   -  griffe: Iteration 1 finished, {len(resolved)} aliases resolved, still {len(unresolved)} to go
DEBUG   -  mkdocstrings: Updating handler's rendering env
DEBUG   -  mkdocstrings: Rendering templates
DEBUG   -  mkdocstrings_handlers: /home/miradilz/.cache/pypoetry/virtualenvs/integrify-MG0a6qln-py3.12/lib/python3.12/site-packages/griffe_pydantic/templates/material/pydantic_model.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/children.html.jinja: Rendering children of integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.order
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.terminal
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.trtype
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.timestamp
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.nonce
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.amount
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.currency
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.model_config
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.action
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.rc
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.approval
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.rrn
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.int_ref
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.p_sign
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.card
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/attribute.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.token
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/function.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.validate_timestamp
DEBUG   -  mkdocstrings_handlers: python/templates/material/signature.html.jinja: Rendering signature
DEBUG   -  mkdocstrings_handlers: python/templates/material/labels.html.jinja: Rendering labels
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring
DEBUG   -  mkdocstrings_handlers: python/templates/material/function.html.jinja: Rendering integrify.azericard.schemas.callback.AuthCallbackWithCardDataSchema.format_timestamp
DEBUG   -  mkdocstrings_handlers: python/templates/material/signature.html.jinja: Rendering signature
DEBUG   -  mkdocstrings_handlers: python/templates/material/docstring.html.jinja: Rendering docstring

Expected behavior

All of the fields should be showin in fields section as it does in ToC

Environment information

python -m griffe_pydantic.debug  # | xclip -selection clipboard

- __System__: Linux-6.8.0-1017-oem-x86_64-with-glibc2.39
- __Python__: cpython 3.12.3 (/home/miradilz/.cache/pypoetry/virtualenvs/integrify-MG0a6qln-py3.12/bin/python)
- __Environment variables__:
- __Installed packages__:
  - `griffe-pydantic` v1.1.0

PASTE MARKDOWN OUTPUT HERE

Additional context

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions