Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Extension does not work when separate_signature is set to True [mkdocs] #9

Closed
mmzeynalli opened this issue Oct 30, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@mmzeynalli
Copy link
Contributor

Description of the bug

So, I had my docs already working. Added new pydantic models and saw that mkdocstrings cannot parse it correctly so I used this extension, but got really similar result.

To Reproduce

My config file:

plugins:
  - search
  - mkdocstrings:
      default_handler: python
      handlers:
        python:
          paths: [../../src]
          options:
            show_root_heading: true
            show_source: false
            show_if_no_docstring: true
            inherited_members: true
            members_order: source
            separate_signature: true
            unwrap_annotated: true
            filters:
            - '!^_'
            merge_init_into_class: true
            docstring_section_style: spacy
            signature_crossrefs: true
            show_symbol_type_heading: true
            show_symbol_type_toc: true
            extensions:
            - griffe_pydantic

Full traceback

Full traceback
PASTE TRACEBACK HERE

Current behavior

The docstrings of fields are shown okay, however, it does not show the types of fields.

image

Expected behavior

If I comment out separate_signature: true, then everything is as expected:

image

Environment information

- __System__: Linux-6.8.0-1014-oem-x86_64-with-glibc2.39
- __Python__: cpython 3.12.3
- __Environment variables__:
- __Installed packages__:
  - `griffe-pydantic` v1.0.0

Additional context

@mmzeynalli mmzeynalli added the unconfirmed This bug was not reproduced yet label Oct 30, 2024
@pawamoy
Copy link
Member

pawamoy commented Nov 3, 2024

Hi @mmzeynalli, thank you for the report. Could you actually provide some code that would allow me to replicate the issue you describe?

@mmzeynalli
Copy link
Contributor Author

So, my Pydantic schemas is simple:

from urllib.parse import parse_qsl

from pydantic import BaseModel, model_validator

class CallbackDataSchema(BaseModel):
    """Raw və encoded callback data schema-sı"""

    data: str
    """Base64 formatında gələn data"""

    signature: str
    """EPOINT_PRIVATE_KEY"""

    @model_validator(mode='before')
    @classmethod
    def convert_str_to_dict(cls, data: bytes) -> dict:
        """Query string formatında gələn datanı düzgün formata çevirmək üçün funksiya"""
        return dict(parse_qsl(data.decode()))

I have provided my mkdocs.yml above, and in markdown file, I just "call": :::integrify.epoint.schemas.callback.CallbackDataSchema, with no extra options.

@pawamoy pawamoy added bug Something isn't working and removed unconfirmed This bug was not reproduced yet labels Dec 3, 2024
pawamoy added a commit to mkdocstrings/python that referenced this issue Dec 3, 2024
…ures in headings

Issue-griffe-pydantic#9: mkdocstrings/griffe-pydantic#9
@pawamoy
Copy link
Member

pawamoy commented Dec 3, 2024

OK it was actually that mkdocstrings-python did not respect the show_signature_annotations option when rendering attribute signatures in headings. It now will!

@pawamoy pawamoy closed this as completed Dec 3, 2024
viktorlashchuk added a commit to viktorlashchuk/mkdocstrings-python that referenced this issue Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants