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

🐛 Make generics work with SQLModel as base class #1275

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

Open
ryangalamb wants to merge 5 commits into fastapi:main
base: main
Choose a base branch
Loading
from ryangalamb:rjmill/fix-generic

Conversation

@ryangalamb
Copy link

@ryangalamb ryangalamb commented Jan 24, 2025

Generics, as documented in pydantic's docs do not work.

Repro: Use the example from pydantic's docs. The typevar type does not get validated.

For example: Response[int](data="not an int") does not raise an error.

Furthermore, json schema generation is broken, as described here: #1002

This PR:

  • fixes generics, so they actually validate (instead of silently passing)
  • includes thorough tests (based on an example from pydantic's docs)

kssion and HosseinMarvi reacted with thumbs up emoji svlandeg reacted with heart emoji
Copy link
Author

ryangalamb commented Jan 24, 2025
edited
Loading

(削除) (I broke the pydantic v1 tests because I added a test and forgot to label it as v2 only. I will fix it when I get back to my computer.) (削除ここまで)

Fixed. Once #1276 is merged, all this PR's tests should pass.

@svlandeg svlandeg added the feature New feature or request label Feb 20, 2025
@svlandeg svlandeg added bug Something isn't working and removed feature New feature or request labels Feb 20, 2025
@svlandeg svlandeg changed the title (削除) fix: make generics work with SQLModel as base class (削除ここまで) (追記) 🐛 Make generics work with SQLModel as base class (追記ここまで) Feb 20, 2025
Copy link
Member

Thanks for the contribution! We're currently trying to catch up with the backlog of PRs, and will get back to you once we've had time to review this 🙏

kssion reacted with thumbs up emoji

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

Reviewers

No reviews

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /