1- from typing import AbstractSet , Any , Callable , Dict , Mapping , Optional , Sequence , Union
1+ from typing import AbstractSet , Any , Callable , Dict , Mapping , Optional , Sequence , Type , Union
22
3- from pydantic .fields import Undefined , UndefinedType
4- from pydantic .typing import NoArgAnyCallable
53from sqlalchemy import Column
6- from sqlmodel .main import FieldInfo
4+ from sqlmodel ._compat import Undefined , UndefinedType , post_init_field_info
5+ from sqlmodel .main import FieldInfo , NoArgAnyCallable
76
87from fastapi_amis_admin .amis import FormItem , TableColumn
98
@@ -23,17 +22,23 @@ def Field(
2322 lt : Optional [float ] = None ,
2423 le : Optional [float ] = None ,
2524 multiple_of : Optional [float ] = None ,
25+ max_digits : Optional [int ] = None ,
26+ decimal_places : Optional [int ] = None ,
2627 min_items : Optional [int ] = None ,
2728 max_items : Optional [int ] = None ,
29+ unique_items : Optional [bool ] = None ,
2830 min_length : Optional [int ] = None ,
2931 max_length : Optional [int ] = None ,
3032 allow_mutation : bool = True ,
3133 regex : Optional [str ] = None ,
32- primary_key : bool = False ,
33- foreign_key : Optional [Any ] = None ,
34- unique : bool = False ,
34+ discriminator : Optional [str ] = None ,
35+ repr : bool = True ,
36+ primary_key : Union [bool , UndefinedType ] = Undefined ,
37+ foreign_key : Any = Undefined ,
38+ unique : Union [bool , UndefinedType ] = Undefined ,
3539 nullable : Union [bool , UndefinedType ] = Undefined ,
3640 index : Union [bool , UndefinedType ] = Undefined ,
41+ sa_type : Union [Type [Any ], UndefinedType ] = Undefined ,
3742 sa_column : Union [Column , UndefinedType ] = Undefined , # type: ignore
3843 sa_column_args : Union [Sequence [Any ], UndefinedType ] = Undefined ,
3944 sa_column_kwargs : Union [Mapping [str , Any ], UndefinedType ] = Undefined ,
@@ -63,22 +68,27 @@ def Field(
6368 lt = lt ,
6469 le = le ,
6570 multiple_of = multiple_of ,
71+ max_digits = max_digits ,
72+ decimal_places = decimal_places ,
6673 min_items = min_items ,
6774 max_items = max_items ,
75+ unique_items = unique_items ,
6876 min_length = min_length ,
6977 max_length = max_length ,
7078 allow_mutation = allow_mutation ,
7179 regex = regex ,
80+ discriminator = discriminator ,
7281 repr = repr ,
7382 primary_key = primary_key ,
7483 foreign_key = foreign_key ,
7584 unique = unique ,
7685 nullable = nullable ,
7786 index = index ,
87+ sa_type = sa_type ,
7888 sa_column = sa_column ,
7989 sa_column_args = sa_column_args ,
8090 sa_column_kwargs = sa_column_kwargs ,
8191 ** current_schema_extra ,
8292 )
83- field_info . _validate ( )
93+ post_init_field_info ( field_info )
8494 return field_info
0 commit comments