Skip to content

Commit

Permalink
Merge pull request fastapi#18 from phi-friday/patch-1
Browse files Browse the repository at this point in the history
fix: parse_obj, validate method return type
  • Loading branch information
leynier authored Jun 8, 2022
2 parents 2914161 + 06df293 commit 227b85e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sqlmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ def from_orm(

@classmethod
def parse_obj(
cls: Type["SQLModel"], obj: Any, update: Optional[Dict[str, Any]] = None
) -> "SQLModel":
cls: Type[_TSQLModel], obj: Any, update: Optional[Dict[str, Any]] = None
) -> _TSQLModel:
obj = cls._enforce_dict_if_root(obj)
# SQLModel, support update dict
if update is not None:
Expand All @@ -572,7 +572,7 @@ def __repr_args__(self) -> Sequence[Tuple[Optional[str], Any]]:

# From Pydantic, override to enforce validation with dict
@classmethod
def validate(cls: Type["SQLModel"], value: Any) -> "SQLModel":
def validate(cls: Type[_TSQLModel], value: Any) -> _TSQLModel:
if isinstance(value, cls):
return value.copy() if cls.__config__.copy_on_model_validation else value

Expand Down

0 comments on commit 227b85e

Please sign in to comment.