- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 784
          🐛 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
base: main
Are you sure you want to change the base?
Conversation
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment was marked as resolved.
        
        
      
    
  This comment was marked as resolved.
| solves #1602 | 
Annotated fields with Pydantic 2.12+
      3f6bec5    to
    eb3cfcc      
    Compare
  
    | Any idea on when a new release with this fix will be available? | 
| 
 Not really, hopefully soon! | 
| 
 That's alright, I'll follow your suggestion. Thanks for the quick reply! | 
Annotated fields with Pydantic 2.12+Annotated fields with Pydantic 2.12+ (alternative 1)
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…4N/sqlmodel into pydantic-2.12-integration
Annotated fields with Pydantic 2.12+ (alternative 1)Annotated fields with Pydantic 2.12+
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work on this, @stickM4N!
This now looks good to merge to me. I've added in the tests from #1602 just for good measure, and refactored the code a bit using Yurii's suggestions. I think it's much easier to follow/maintain like this, without the continue & break statements.
Will yet run this by Tiangolo for a final review.
Note that another alternative to this PR is #1607 - if we decide to merge this, we can close the other one.
After
pydanticupdate to support Python 3.14, different declaration syntax were affected by the changed.I check and on
pydanticside there is not changes on the resultingFieldInfostructure, at least at first glance.In the tests I illustrated the 3 possible declaration syntax for annotations defined by
pydanticand supported so far bysqlmodel. Two of them do not work any more withpydantic>=2.12!