Skip to content

Commit 3e99ca2

Browse files
committed
Added more type definition to detail schema.
1 parent 8f09029 commit 3e99ca2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ninja_extra/controllers/response.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import abc
2-
from typing import Any, Optional, Type, Union
2+
from typing import Any, Dict, Optional, Type, Union
33

44
from ninja import Schema
55
from pydantic.types import UUID1, UUID3, UUID4, UUID5
@@ -62,7 +62,7 @@ def get_schema(cls) -> Union[Schema, Type[Schema], Any]:
6262

6363
class Detail(ControllerResponse):
6464
status_code: int = status.HTTP_200_OK
65-
message: Any = dict()
65+
message: Union[str, Dict] = dict()
6666

6767
def __init__(
6868
self, message: Optional[Any] = None, status_code: int = status.HTTP_200_OK
@@ -72,7 +72,7 @@ def __init__(
7272
self.status_code = status_code or self.status_code
7373

7474
class Detail(Schema):
75-
message: Any
75+
message: Union[str, Dict]
7676

7777
def convert_to_schema(self) -> Any:
7878
return self.Detail.from_orm(self)

0 commit comments

Comments
 (0)