-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Labels
libraryDedicated support for popular third-party librariesDedicated support for popular third-party libraries
Description
Summary
Ty flags missing required fields for pydantic.BaseModel
but not for sqlmodel.SQLModel
subclasses, both using Pydantic v2.
Minimal repro
from __future__ import annotations
from pydantic import BaseModel
from sqlmodel import SQLModel
class ExamplePydantic(BaseModel):
number: float
class ExampleSQLModel(SQLModel):
number: float
ExampleSQLModel() # ty: no error (bug)
ExamplePydantic() # ty: error (good)
Expected
Expected: Both ExampleSQLModel()
and ExamplePydantic()
are flagged as missing required field number.
Actual: Only ExamplePydantic()
is flagged, ExampleSQLModel()
passes.
Environment
python: 3.11.10
sqlmodel: 0.0.27
OS: MacOS Tahoe (26.0.1)
Version
ty 0.0.1-alpha.21 (ef52a19 2025-09-19)
Metadata
Metadata
Assignees
Labels
libraryDedicated support for popular third-party librariesDedicated support for popular third-party libraries