Skip to content

Commit

Permalink
fix bug [issubclass() arg 1 must be a class]
Browse files Browse the repository at this point in the history
  • Loading branch information
Friskes committed May 2, 2024
1 parent 93a0054 commit e9e9d20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ ci = [


[project.urls]
"Documentation" = "https://github.com/Friskes/drf-serializer-dumps" # Home-page in pip show
"Repository" = "https://github.com/Friskes/drf-serializer-dumps"
"Changelog" = "https://github.com/Friskes/drf-serializer-dumps/releases/"
"Bug Reports" = "https://github.com/Friskes/drf-serializer-dumps/issues"
Expand Down
6 changes: 4 additions & 2 deletions src/drf_serializer_dumps/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

__all__ = ('serializer_dumps',)

UnionType = type(int | str) # py 3.8 does not have types.UnionType

_uuid = uuid4()
_now = timezone.now()

Expand Down Expand Up @@ -152,8 +154,8 @@ def _get_type_value(
annotation = get_type_hints(method).get('return')

# origin = get_origin(annotation)
# if origin is Union or origin is type(Union):
if get_origin(annotation) in (Union, type(Union)):
# if origin is Union or origin is UnionType:
if get_origin(annotation) in (Union, UnionType):
annotation = get_args(annotation)[0]

type_value = type_mapping.get(open_api_type)
Expand Down

0 comments on commit e9e9d20

Please sign in to comment.