Skip to content
New issue

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

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

Already on GitHub? # to your account

change: Detect and show pydantic ClassVar attibutes #23

Closed
mmzeynalli opened this issue Feb 10, 2025 · 3 comments
Closed

change: Detect and show pydantic ClassVar attibutes #23

mmzeynalli opened this issue Feb 10, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@mmzeynalli
Copy link

mmzeynalli commented Feb 10, 2025

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

If I have:

from pydantic import BaseModel
from pydantic.alias_generators import to_pascal

class BaseRequestSchema(BaseModel):
    model_config = ConfigDict(alias_generator=AliasGenerator(serialization_alias=to_pascal))

    URL_PARAM_FIELDS: ClassVar[list[str]]

    merchant: str

I get doc like:

Image

Even if model_config is parsed differently (as it should), URL_PARAM_FIELDS is showing label of pydantic-field. However, it is not considered a pydantic field and is not validated/serialized as part of process.

Describe the solution you'd like

To show in the docs as ClassVar instead of pydantic-field

Describe alternatives you've considered

Additional context

@pawamoy pawamoy added the bug Something isn't working label Feb 11, 2025
@pawamoy
Copy link
Member

pawamoy commented Feb 11, 2025

Thanks @mmzeynalli, marking as a bug 🙂

@pawamoy
Copy link
Member

pawamoy commented Feb 11, 2025

Kinda related to #18.

@mmzeynalli
Copy link
Author

Yes, missed that one to be honest. Considering it is the same, I am closing this one.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants