Skip to content

Commit

Permalink
馃懛 Fix jsonable_encoder to respect include and exclude args
Browse files Browse the repository at this point in the history
  • Loading branch information
DCsunset committed Sep 4, 2022
1 parent 3079ba9 commit 1aa1f89
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions fastapi/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ def jsonable_encoder(
sqlalchemy_safe=sqlalchemy_safe,
)
if dataclasses.is_dataclass(obj):
obj_dict = dataclasses.asdict(obj)
return jsonable_encoder(
obj_dict,
exclude_none=exclude_none,
dataclasses.asdict(obj),
include=include,
exclude=exclude,
by_alias=by_alias,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
exclude_none=exclude_none,
custom_encoder=custom_encoder,
sqlalchemy_safe=sqlalchemy_safe,
)
Expand Down

0 comments on commit 1aa1f89

Please sign in to comment.