Skip to content

Commit b7e8d76

Browse files
authored
Merge pull request #254 from python-ellar/pydantic_2102_fix
fix: Pydantic Version 2.10.2 bug
2 parents bcf1534 + f9a9d66 commit b7e8d76

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

ellar/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Ellar - Python ASGI web framework for building fast, efficient, and scalable RESTful APIs and server-side applications."""
22

3-
__version__ = "0.8.6"
3+
__version__ = "0.8.7"

ellar/core/conf/app_settings_models.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
if t.TYPE_CHECKING: # pragma: no cover
2727
from ellar.app.main import App
2828

29+
AppType = t.TypeVar("AppType", bound="App")
30+
2931
TEMPLATE_TYPE = t.Dict[
3032
str, t.Union[t.Callable[..., t.Any], t.Dict[str, t.Callable[..., t.Any]]]
3133
]
@@ -197,9 +199,9 @@ class ConfigSchema(Serializer, ConfigDefaultTypesMixin):
197199
DEFAULT_NOT_FOUND_HANDLER: ASGIApp = _not_found
198200
# The lifespan context function is a newer style that replaces
199201
# on_startup / on_shutdown handlers. Use one or the other, not both.
200-
DEFAULT_LIFESPAN_HANDLER: t.Optional[t.Callable[["App"], t.AsyncContextManager]] = (
201-
None
202-
)
202+
DEFAULT_LIFESPAN_HANDLER: t.Optional[
203+
t.Callable[[AppType], t.AsyncContextManager]
204+
] = None
203205

204206
# Object Serializer custom encoders
205207
SERIALIZER_CUSTOM_ENCODER: t.Dict[t.Any, t.Callable[[t.Any], t.Any]] = (
@@ -248,3 +250,6 @@ def pre_cache_validate(cls, value: t.Dict) -> t.Any:
248250
if value and not value.get("default"):
249251
raise ValueError("CACHES configuration must have a 'default' key")
250252
return value
253+
254+
255+
ConfigSchema.model_rebuild()

0 commit comments

Comments
 (0)