Fix protected namespace warning for model_custom_emoji_id (#1775)

* fix UserWarning, model_custom_emoji_id

* Add changelog for #1772
This commit is contained in:
Bogdan I 2026-03-03 04:24:05 +05:00 committed by GitHub
parent f68c24d620
commit bd75ae361e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

1
CHANGES/1772.bugfix.rst Normal file
View file

@ -0,0 +1 @@
Fixed Pydantic protected namespace warning for `model_custom_emoji_id` by adding `protected_namespaces=()` to `model_config`.

View file

@ -1,10 +1,9 @@
from typing import Any from typing import Any
from unittest.mock import sentinel from unittest.mock import sentinel
from pydantic import BaseModel, ConfigDict, model_validator
from aiogram.client.context_controller import BotContextController from aiogram.client.context_controller import BotContextController
from aiogram.client.default import Default from aiogram.client.default import Default
from pydantic import BaseModel, ConfigDict, model_validator
class TelegramObject(BotContextController, BaseModel): class TelegramObject(BotContextController, BaseModel):
@ -16,6 +15,7 @@ class TelegramObject(BotContextController, BaseModel):
populate_by_name=True, populate_by_name=True,
arbitrary_types_allowed=True, arbitrary_types_allowed=True,
defer_build=True, defer_build=True,
protected_namespaces=(),
) )
@model_validator(mode="before") @model_validator(mode="before")