Skip to content

Commit

Permalink
fix (#51): restore CreateBaseModel model
Browse files Browse the repository at this point in the history
  • Loading branch information
Lancetnik committed Dec 22, 2023
1 parent 458e8f1 commit 120cd34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fast_depends/__about__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""FastDepends - extracted and cleared from HTTP domain FastAPI Dependency Injection System"""

__version__ = "2.2.7"
__version__ = "2.2.8"
9 changes: 9 additions & 0 deletions fast_depends/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def get_config_base(config_data: Optional[ConfigDict] = None) -> ConfigDict:
def get_model_fields(model: Type[BaseModel]) -> Dict[str, FieldInfo]:
return model.model_fields

class CreateBaseModel(BaseModel):
"""Just to support FastStream < 0.3.7."""
model_config = ConfigDict(arbitrary_types_allowed=True)

else:
from pydantic.fields import ModelField as FieldInfo # type: ignore
from pydantic.typing import evaluate_forwardref as evaluate_forwardref # type: ignore[no-redef]
Expand All @@ -44,3 +48,8 @@ def get_config_base(config_data: Optional[ConfigDict] = None) -> Type[BaseConfig

def get_model_fields(model: Type[BaseModel]) -> Dict[str, FieldInfo]:
return model.__fields__ # type: ignore[return-value]

class CreateBaseModel(BaseModel): # type: ignore[no-redef]
"""Just to support FastStream < 0.3.7."""
class Config:
arbitrary_types_allowed = True

0 comments on commit 120cd34

Please sign in to comment.