-
-
Notifications
You must be signed in to change notification settings - Fork 782
🐛 Fix support for Annotated fields with Pydantic 2.12+
#1603
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
stickm4n
wants to merge
20
commits into
fastapi:main
Choose a base branch
from
stickm4n:pydantic-2.12-integration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+123
−1
Open
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
66e1bfe
Fix sqlmodel field being overide by pydantic
stickm4n 93e15c1
Add tests for syntax declaration
stickm4n 38dc566
Simplify logic
stickm4n 1b69033
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
pre-commit-ci[bot] 46ce312
Add type ignore comment for field assignment
stickm4n cf62a18
Remove type ignore comments from execute method signatures
stickm4n 7fd7f0c
Fix inheritance attrib not being properly parsed
stickm4n 28445d1
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
pre-commit-ci[bot] b867ad7
Fix inheritance when getting annotations
stickm4n 68beb72
Fix type ignore comment for annotation retrieval
stickm4n 45af011
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
pre-commit-ci[bot] b50566d
Fix col form field for pydantic 1
stickm4n 6fd5534
Fix import
stickm4n ee8fd7b
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
pre-commit-ci[bot] eb3cfcc
Fix field annotation retrieval for pydantic integration
stickm4n 7d75b6e
Merge branch 'main' into pydantic-2.12-integration
svlandeg 16c21c1
🐛 Fix composite primary with AfterValidator/Annotated
patrick91 984e040
Merge branch 'main' into pydantic-2.12-integration
svlandeg 9235285
refactor according to Yurii's suggestion
svlandeg 57f75ef
Merge branch 'pydantic-2.12-integration' of https://github.com/stickM…
svlandeg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| from sqlmodel import Field, SQLModel | ||
| from typing_extensions import Annotated | ||
|
|
||
|
|
||
| def test_declaration_syntax_1(): | ||
| class Person1(SQLModel): | ||
| name: str = Field(primary_key=True) | ||
|
|
||
| class Person1Final(Person1, table=True): | ||
| pass | ||
|
|
||
|
|
||
| def test_declaration_syntax_2(): | ||
| class Person2(SQLModel): | ||
| name: Annotated[str, Field(primary_key=True)] | ||
|
|
||
| class Person2Final(Person2, table=True): | ||
| pass | ||
|
|
||
|
|
||
| def test_declaration_syntax_3(): | ||
| class Person3(SQLModel): | ||
| name: Annotated[str, ...] = Field(primary_key=True) | ||
|
|
||
| class Person3Final(Person3, table=True): | ||
| pass |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.