Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🐛 Improvejsonable_encoder for other types of iterables#13803

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Lob26 wants to merge4 commits intofastapi:master
base:master
Choose a base branch
Loading
fromLob26:jsonable_encoder

Conversation

Lob26
Copy link

What was changed

Updated the jsonable_encoder function to correctly handle any iterable type.

Reordered conditionals to ensure the iterable check occurs later, allowing appropriate handling to other type-specific branches (which previously caused failures).

Why this change is necessary

The previous implementation did not correctly serialize objects likesqlalchemy.engine.Row, which inherit fromcollections.abc.Sequence but behave differently than standard lists or tuples. This led to unexpected failures or incorrect encoding.

Testing

Manually tested the updated function against a wide variety of data structures
Behavior appears consistent and correct across all tested inputs.

Notes

While the function now gracefully handles many iterables, I'm still wary there may be edge cases I haven't considered. Further review and test cases are welcome.

@Lob26Lob26 changed the titleImprove jsonable_encoder for other types of iterablesfeature: Improve jsonable_encoder for other types of iterablesJun 18, 2025
@Lob26Lob26 marked this pull request as draftJune 18, 2025 22:06
@svlandegsvlandeg added the bugSomething isn't working labelJun 23, 2025
@svlandegsvlandeg changed the titlefeature: Improve jsonable_encoder for other types of iterables🐛 Improvejsonable_encoder for other types of iterablesJun 23, 2025
from pydantic.networks import AnyUrl, NameEmail
from pydantic.types import SecretBytes, SecretStr
from pydantic_extra_types.color import Color
Copy link
Contributor

Choose a reason for hiding this comment

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

This package supports pydantic 2.x only

Lob26 reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

Same forCoordinate type

@rhealakhotia
Copy link

Hi@Lob26, I’m new to open source but would love to help with this.
Could you clarify:

  • Which edge cases still need testing?
  • How to reproduce the SQLAlchemy row issue locally?

I’ll try to write a test case and debug the CI failures. Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dolfinusdolfinusdolfinus left review comments

Assignees
No one assigned
Labels
bugSomething isn't working
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@Lob26@rhealakhotia@dolfinus@svlandeg

[8]ページ先頭

©2009-2025 Movatter.jp