Skip to content

Improve BaseSerializer and ListSerializer method to_representation() #509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

intgr
Copy link
Contributor

@intgr intgr commented Nov 15, 2023

FYI @4c0n, this is a follow-up to #504.

The original PR changed BaseSerializer.to_representation() to return dict[str, Any].

However, turns out BaseSerializer subclass ListSerializer method actualy returns list.

Changed now:

  • BaseSerializer.to_representation() -> Any
  • Serializer.to_representation() -> dict[str, Any]
  • ListSerializer.to_representation() -> list[Any]
  • Also improved ListSerializer.to_representation() argument type

Related issues

@intgr intgr changed the title Improve BaseSerializer and ListSerializer to_representation() return type Improve BaseSerializer and ListSerializer method to_representation() Nov 15, 2023
Copy link
Contributor

@4c0n 4c0n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that seems right, I totally overlooked that part!

@intgr intgr merged commit 7840ec6 into typeddjango:master Nov 19, 2023
@intgr intgr deleted the fix-BaseSerializer-ListSerializer-to_representation branch November 19, 2023 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants