1- # Prompt
1+ ---
2+ mode : ' edit'
3+ description : ' Update user messages'
4+ ---
5+
26
3- ```
47Please convert all pydantic model fields that use ` Field() ` with default values to use the Annotated pattern instead.
58Follow these guidelines:
69
@@ -10,7 +13,8 @@ Follow these guidelines:
10134 . Add the import: ` from common_library.basic_types import DEFAULT_FACTORY ` if it's not already present.
11145 . If ` Field() ` has no parameters (empty), don't use Annotated at all. Just use: ` field_name: field_type = default_value ` .
12156 . Leave any model validations, ` model_config ` settings, and ` field_validators ` untouched.
13- ```
16+
17+
1418## Examples
1519
1620### Before:
@@ -53,6 +57,7 @@ class ProjectModel(BaseModel):
5357 id : str = Field(default_factory = uuid.uuid4, description = " Unique project identifier" )
5458 name: str = Field(default = " Untitled Project" , min_length = 3 , max_length = 50 )
5559 created_at: datetime = Field(default_factory = datetime.now)
60+ value: int = Field(... , description = " Project value" )
5661 config: dict = Field(default = {" version" : " 1.0" , " theme" : " default" })
5762
5863 @field_validator (" name" )
@@ -74,6 +79,7 @@ class ProjectModel(BaseModel):
7479 id : Annotated[str , Field(default_factory = uuid.uuid4, description = " Unique project identifier" )] = DEFAULT_FACTORY
7580 name: Annotated[str , Field(min_length = 3 , max_length = 50 )] = " Untitled Project"
7681 created_at: Annotated[datetime, Field(default_factory = datetime.now)] = DEFAULT_FACTORY
82+ value: Annotated[int , Field(description = " Project value" )]
7783 config: dict = {" version" : " 1.0" , " theme" : " default" }
7884
7985 @field_validator (" name" )
0 commit comments